aboutsummaryrefslogtreecommitdiff
path: root/tests/soc_simple_display/test.v
diff options
context:
space:
mode:
Diffstat (limited to 'tests/soc_simple_display/test.v')
-rw-r--r--tests/soc_simple_display/test.v106
1 files changed, 106 insertions, 0 deletions
diff --git a/tests/soc_simple_display/test.v b/tests/soc_simple_display/test.v
new file mode 100644
index 0000000..de05ff0
--- /dev/null
+++ b/tests/soc_simple_display/test.v
@@ -0,0 +1,106 @@
+`default_nettype none
+`timescale 1ns/1ns
+
+`include "messages.vh"
+
+`ifndef SIMULATION
+ `error_SIMULATION_not_defined
+; /* Cause syntax error */
+`endif
+
+module soc_test();
+ wire [17:0] sram_addr;
+ wire [15:0] sram_io;
+ wire sram_cs_n;
+ wire sram_oe_n;
+ wire sram_we_n;
+
+ wire vga_hs;
+ wire vga_vs;
+ wire [2:0] vga_red;
+ wire [2:0] vga_green;
+ wire [2:0] vga_blue;
+
+ wire led1;
+ wire led2;
+
+ wire [9:0] image_writes;
+
+ reg clock_100mhz;
+ reg reset;
+
+ VGA_640_480_60Hz vga_display
+ (
+ .horizontal_sync(vga_hs),
+ .vertical_sync(vga_vs),
+
+ .red(vga_red),
+ .green(vga_green),
+ .blue(vga_blue),
+
+ .image_writes(image_writes)
+ );
+
+ K6R4016V1D_TC10_sram sram
+ (
+ .sram_addr(sram_addr),
+ .sram_io(sram_io),
+ .sram_cs_not(sram_cs_n),
+ .sram_oe_not(sram_oe_n),
+ .sram_we_not(sram_we_n)
+ );
+
+ soc
+ #(
+ .FONT_FILE("../../design/font.mem"),
+ .ROM_FILE("instructions.mem")
+ ) soc
+ (
+ .clock_100mhz(clock_100mhz),
+
+ .sram_addr(sram_addr),
+ .sram_io(sram_io),
+
+ .sram_cs_n(sram_cs_n),
+ .sram_oe_n(sram_oe_n),
+ .sram_we_n(sram_we_n),
+
+ .vga_hs(vga_hs),
+ .vga_vs(vga_vs),
+ .vga_red(vga_red),
+ .vga_green(vga_green),
+ .vga_blue(vga_blue),
+
+ .button1(!reset),
+ .button2(1'b1),
+
+ .led1(led1),
+ .led2(led2)
+ );
+
+ integer i;
+
+ initial begin
+ reset <= 1;
+ clock_100mhz <= 0;
+
+ for (i = 0; i < 5_000_000; i++) begin
+ #5;
+
+ if (clock_100mhz)
+ reset <= 0;
+
+ clock_100mhz <= ~clock_100mhz;
+ end
+
+ if (led1)
+ `MSG(("error: stack machine in soc hasn't finished working in 25ms"));
+ else
+ `MSG(("error: nothing got displayed in 25ms"));
+ end
+
+ always @ (image_writes) begin
+ if (image_writes)
+ $finish;
+ end
+endmodule // soc_test