cpu/picorv32: Extract picorv32 parameters from Instance constructor to facilitate...
authorWilliam D. Jones <thor0505@comcast.net>
Mon, 29 Oct 2018 04:59:13 +0000 (00:59 -0400)
committerWilliam D. Jones <thor0505@comcast.net>
Tue, 30 Oct 2018 10:00:45 +0000 (06:00 -0400)
litex/soc/cores/cpu/picorv32/core.py

index 7fe830d66acbf6433f73104ed9610426c7135052..349cfe103127dce0317561cc8456714e5e809e1b 100644 (file)
@@ -29,31 +29,39 @@ class PicoRV32(Module):
         mem_wstrb = Signal(4)
         mem_rdata = Signal(32)
 
+        # PicoRV32 parameters. To create a new variant, modify this dictionary
+        # and change the desired parameters.
+        picorv32_params = {
+            "p_ENABLE_COUNTERS" : 1,
+            "p_ENABLE_COUNTERS64" : 1,
+            # Changing REGS has no effect as on FPGAs, the registers are
+            # implemented using a register file stored in DPRAM.
+            "p_ENABLE_REGS_16_31" : 1,
+            "p_ENABLE_REGS_DUALPORT" : 1,
+            "p_LATCHED_MEM_RDATA" : 0,
+            "p_TWO_STAGE_SHIFT" : 1,
+            "p_TWO_CYCLE_COMPARE" : 0,
+            "p_TWO_CYCLE_ALU" : 0,
+            "p_CATCH_MISALIGN" : 1,
+            "p_CATCH_ILLINSN" : 1,
+            "p_ENABLE_PCPI" : 0,
+            "p_ENABLE_MUL" : 1,
+            "p_ENABLE_DIV" : 1,
+            "p_ENABLE_FAST_MUL" : 0,
+            "p_ENABLE_IRQ" : 1,
+            "p_ENABLE_IRQ_QREGS" : 1,
+            "p_ENABLE_IRQ_TIMER" : 1,
+            "p_ENABLE_TRACE" : 0,
+            "p_MASKED_IRQ" : 0x00000000,
+            "p_LATCHED_IRQ" : 0xffffffff,
+            "p_PROGADDR_RESET" : progaddr_reset,
+            "p_PROGADDR_IRQ" : 0x00000010,
+            "p_STACKADDR" : 0xffffffff
+        }
+
         self.specials += Instance("picorv32",
             # parameters
-            p_ENABLE_COUNTERS=1,
-            p_ENABLE_COUNTERS64=1,
-            p_ENABLE_REGS_16_31=1,
-            p_ENABLE_REGS_DUALPORT=1,
-            p_LATCHED_MEM_RDATA=0,
-            p_TWO_STAGE_SHIFT=1,
-            p_TWO_CYCLE_COMPARE=0,
-            p_TWO_CYCLE_ALU=0,
-            p_CATCH_MISALIGN=1,
-            p_CATCH_ILLINSN=1,
-            p_ENABLE_PCPI=0,
-            p_ENABLE_MUL=1,
-            p_ENABLE_DIV=1,
-            p_ENABLE_FAST_MUL=0,
-            p_ENABLE_IRQ=1,
-            p_ENABLE_IRQ_QREGS=1,
-            p_ENABLE_IRQ_TIMER=1,
-            p_ENABLE_TRACE=0,
-            p_MASKED_IRQ=0x00000000,
-            p_LATCHED_IRQ=0xffffffff,
-            p_PROGADDR_RESET=progaddr_reset,
-            p_PROGADDR_IRQ=0x00000010,
-            p_STACKADDR=0xffffffff,
+            **picorv32_params,
 
             # clock / reset
             i_clk=ClockSignal(),