add RESET_ADDRESS parameter into Makefile,
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 24 Apr 2022 14:57:11 +0000 (15:57 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 24 Apr 2022 14:58:33 +0000 (15:58 +0100)
bring it into top-generic.vhdl, but shifted by 16 because VHDL refuses
to allow 32-bit integers (only 31-bit, sigh)

Makefile
fpga/top-generic.vhdl

index c6e31d483f3a855c6d93602decff76d0ddef2d02..610f48d8c89be6d5b9902d7f1bf61f8b6d98ffc0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -214,7 +214,10 @@ _fpga_files = fpga/soc_reset.vhdl \
        nonrandom.vhdl
 
 # use an alternative core (in verilog)
-EXTERNAL_CORE=true
+EXTERNAL_CORE=false
+# VHDL does not allow integers greater than 2^32, so shift down
+# by 16 bits and add 16 bits zeros back on in soc-generic.vhdl
+RESET_ADDRESS=65280 # 0xff00_0000>>16
 ifeq ($(EXTERNAL_CORE),false)
     fpga_files = $(_fpga_files) $(_soc_files) $(core_files)
     synth_files = $(core_files) $(soc_files) $(fpga_files) $(clkgen) $(toplevel) $(dmi_dtm)
@@ -226,9 +229,14 @@ else
     soc_extra_v = external_core_top.v
 endif
 
-GHDL_IMAGE_GENERICS=-gMEMORY_SIZE=$(MEMORY_SIZE) -gRAM_INIT_FILE=$(RAM_INIT_FILE) \
-       -gRESET_LOW=$(RESET_LOW) -gCLK_INPUT=$(CLK_INPUT) -gCLK_FREQUENCY=$(CLK_FREQUENCY) \
-       -gSIM_MAIN_BRAM=$(SIM_MAIN_BRAM) -gSIM_BRAM_CHAINBOOT=$(SIM_BRAM_CHAINBOOT) \
+GHDL_IMAGE_GENERICS=-gMEMORY_SIZE=$(MEMORY_SIZE) \
+    -gRAM_INIT_FILE=$(RAM_INIT_FILE) \
+       -gRESET_LOW=$(RESET_LOW) \
+       -gRESET_ADDRESS=$(RESET_ADDRESS) \
+    -gCLK_INPUT=$(CLK_INPUT) \
+    -gCLK_FREQUENCY=$(CLK_FREQUENCY) \
+       -gSIM_MAIN_BRAM=$(SIM_MAIN_BRAM) \
+    -gSIM_BRAM_CHAINBOOT=$(SIM_BRAM_CHAINBOOT) \
        -gEXTERNAL_CORE=$(EXTERNAL_CORE)
 
 microwatt.json: $(synth_files) $(RAM_INIT_FILE)
index 3aabe93540bfc3872d36549d50feb3566f1df822..0ce8456d0f781e858a4d70c8ffe46b90c119d216 100644 (file)
@@ -1,5 +1,6 @@
 library ieee;
 use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
 
 library work;
 use work.wishbone_types.all;
@@ -14,6 +15,7 @@ entity toplevel is
        EXTERNAL_CORE     : boolean  := false;
        SIM_MAIN_BRAM     : boolean  := false;
        SIM_BRAM_CHAINBOOT  : positive  := 0;
+       RESET_ADDRESS  : integer  := 0;
        CLK_INPUT     : positive := 100000000;
        CLK_FREQUENCY : positive := 100000000;
         HAS_FPU       : boolean  := true;
@@ -102,7 +104,9 @@ begin
             LOG_LENGTH    => LOG_LENGTH,
            DISABLE_FLATTEN_CORE => DISABLE_FLATTEN_CORE,
             UART0_IS_16550     => UART_IS_16550,
-            HAS_UART1     => HAS_UART1
+            HAS_UART1     => HAS_UART1,
+            RESET_ADDRESS => (std_ulogic_vector(to_unsigned(RESET_ADDRESS, 48)
+                              & x"0000"))
            )
        port map (
            system_clk        => system_clk,