sort out platform IO pads for iverilog hyperram sim
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 26 Mar 2022 21:21:48 +0000 (21:21 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 26 Mar 2022 21:21:48 +0000 (21:21 +0000)
runsimsoc_hyperram.sh
src/ls2.py

index 02e4389ea203b99be6d81dfdce98182da3e59280..4e235d45a70139fc46c8116d8e1987f3946bdc44 100755 (executable)
@@ -3,7 +3,7 @@ set -e
 
 LIB_DIR=./src/ecp5u
 
-HYPERRAM_DIR=./s27kl0641/model
+HYPERRAM_DIR=./hyperram_model/s27kl0641/model
 
 # create the build_simsoc/top.il file with firmware baked-in
 python3 src/ls2.py isim ./coldboot/coldboot.bin
@@ -16,8 +16,8 @@ cp ${LIB_DIR}/DDRDLLA.v DDRDLLA.v
 patch DDRDLLA.v < DDRDLLA.patch
 
 # string together the icarus verilog files and start runnin
-iverilog -Wall -g2012 -s simsoctb -o simsoc \
-        src/simsoctb.v ./top.v \
+iverilog -Wall -g2012 -s simsoc_hyperram_tb -o simsoc \
+        src/simsoc_hyperram_tb.v ./top.v \
     ${HYPERRAM_DIR}/s27kl0641.v \
     ${LIB_DIR}/ECLKSYNCB.v ${LIB_DIR}/EHXPLLL.v \
     ${LIB_DIR}/PUR.v ${LIB_DIR}/GSR.v \
index 9c057ac1c3aa6a465636a68b8aff737abd3c2959..3aa51e48d9d3f017e707303961ec666b7527e9bd 100644 (file)
@@ -578,10 +578,14 @@ def build_platform(fpga, firmware):
     else:
         platform = None
 
+    print ("platform", fpga, firmware, platform)
+
     # set clock frequency
     clk_freq = 70e6
     if fpga == 'sim':
         clk_freq = 100e6
+    if fpga == 'isim':
+        clk_freq = 50e6 # below 50 mhz, stops DRAM being enabled
     if fpga == 'versa_ecp5':
         clk_freq = 50e6 # crank right down to test hyperram
     if fpga == 'versa_ecp5_85':
@@ -631,8 +635,17 @@ def build_platform(fpga, firmware):
 
     # Get HyperRAM pins
     hyperram_pins = None
-    if platform is None or platform in ['isim']:
+    if platform is None:
         hyperram_pins = HyperRAMPads()
+    elif fpga in ['isim']:
+        hyperram_ios = HyperRAMResource(0, cs_n="B11",
+                                        dq="D4 D3 F4 F3 G2 H2 D2 E2",
+                                        rwds="U13", rst_n="T13", ck_p="V10",
+                                        # ck_n="D12" - for later (DDR)
+                                        attrs=Attrs(IOSTANDARD="LVCMOS33"))
+        platform.add_resources(hyperram_ios)
+        hyperram_pins = platform.request("hyperram")
+        print ("isim a7 hyperram", hyperram_ios)
     # Digilent Arty A7-100t
     elif platform is not None and fpga in ['arty_a7']:
         hyperram_ios = HyperRAMResource(0, cs_n="B11",
@@ -652,6 +665,7 @@ def build_platform(fpga, firmware):
         platform.add_resources(hyperram_ios)
         hyperram_pins = platform.request("hyperram")
         print ("versa ecp5 hyperram", hyperram_ios)
+    print ("hyperram pins", hyperram_pins)
 
     # set up the SOC
     soc = DDR3SoC(fpga=fpga, dram_cls=dram_cls,