--- /dev/null
+ifeq ($(SIM),)
+ $(error Use one of the run_*.sh scripts to run cocotb test bench)
+endif
+
+TOPLEVEL_LANG := verilog
+
+# within soc repo, as submodule, this works after "make ls180"
+# is run inside the litex/florent subdirectory
+VERILOG_SOURCES := \
+ ../spblock_512w64b8w.v \
+ ../pll.v \
+ full_core_4_4ksram_libresoc_recon.v \
+ full_core_4_4ksram_litex_ls180_recon.v \
+# END VERILOG_SOURCES
+
+MODULE := test
+
+include $(shell cocotb-config --makefiles)/Makefile.sim
--- /dev/null
+../pre_pnr/idcode.svf
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+
+touch mem.init mem_1.init mem_2.init mem_3.init mem_4.init
+# Only run test in reset state as running CPU takes too much time to simulate
+make \
+ SIM=icarus \
+ TOPLEVEL=ls180 \
+ COCOTB_RESULTS_FILE=results_iverilog_ls180.xml \
+ COCOTB_HDL_TIMEUNIT=100ps \
+ TESTCASE="idcode_reset,idcodesvf_reset,boundary_scan_reset" \
+ SIM_BUILD=sim_build_iverilog_ls180
+
+
--- /dev/null
+../pre_pnr/test.py
\ No newline at end of file
--- /dev/null
+// PLL simulation model; just connect input clock to output clock
+module pll(ref_v, div_out_test, a0, a1, vco_test_ana, out_v);
+ input a0;
+ input a1;
+ output div_out_test;
+ output out_v;
+ input ref_v;
+ output vco_test_ana;
+
+assign out_v = ref_v;
+assign vco_test_ana = 0;
+assign div_out_test = 0;
+
+endmodule
+
--- /dev/null
+// SPBlock_512W64B8W simulation mode
+module spblock_512w64b8w(
+ input clk,
+ input [8:0] a,
+ input [63:0] d,
+ output [63:0] q,
+ // Width of WE determines the write granularity
+ input [7:0] we
+);
+
+genvar i;
+
+reg [63:0] ram [511:0];
+wire[7:0] d_split [7:0];
+reg [8:0] a_hold;
+
+always @(posedge clk) begin
+ a_hold <= a;
+end
+
+assign q = ram[a_hold];
+
+generate
+ for (i = 0; i < 8; i = i + 1) begin
+ assign d_split[i] = d[((i + 1)*8 - 1):i*8];
+
+ always @(posedge clk) begin
+ if (we[i]) begin
+ ram[a][((i + 1)*8 - 1):i*8] = d_split[i];
+ end
+ end
+ end
+endgenerate
+
+endmodule