cpuif.py: add _ADDR and _SIZE defines for each register
authorRobert Jordens <jordens@gmail.com>
Fri, 8 Nov 2013 07:25:38 +0000 (00:25 -0700)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sun, 10 Nov 2013 09:44:39 +0000 (10:44 +0100)
Signed-off-by: Robert Jordens <jordens@gmail.com>
misoclib/cpuif.py

index b24677416f272c9930871b49b60e9c86218c71f9..5c30289c1bd4e55377571ebb68c3c9673cf7c95c 100644 (file)
@@ -2,6 +2,10 @@ from migen.bank.description import CSRStatus
 
 def _get_rw_functions(reg_name, reg_base, size, read_only):
        r = ""
+
+       r += "#define CSR_"+reg_name.upper()+"_ADDR "+hex(reg_base)+"\n"
+       r += "#define CSR_"+reg_name.upper()+"_SIZE "+str(size)+"\n"
+
        if size > 8:
                raise NotImplementedError("Register too large")
        elif size > 4: