72 lines
2.1 KiB
Verilog
72 lines
2.1 KiB
Verilog
// -----------------------------------------------------------------------------
|
|
// tb_z3_demo_ice.v -- Local testbench for z3_demo_ice_top
|
|
//
|
|
// Used to verify that the hardware self-checking FSM inside z3_demo_ice_top
|
|
// runs correctly to completion and asserts led_pass BEFORE downloading into
|
|
// Palladium Z3 hardware.
|
|
// -----------------------------------------------------------------------------
|
|
`timescale 1ns/1ps
|
|
|
|
module tb_z3_demo_ice;
|
|
|
|
reg clk;
|
|
reg rst_n;
|
|
wire [7:0] led_gpio;
|
|
wire led_irq;
|
|
wire led_done;
|
|
wire led_pass;
|
|
wire led_fail;
|
|
|
|
z3_demo_ice_top u_ice_top (
|
|
.clk_in (clk),
|
|
.rst_n_in (rst_n),
|
|
.led_gpio (led_gpio),
|
|
.led_irq (led_irq),
|
|
.led_done (led_done),
|
|
.led_pass (led_pass),
|
|
.led_fail (led_fail)
|
|
);
|
|
|
|
always #5 clk = ~clk;
|
|
|
|
initial begin
|
|
clk = 0;
|
|
rst_n = 0;
|
|
|
|
`ifdef LOCAL_SIM
|
|
$dumpfile("ice/sim_local/z3_demo_ice.vcd");
|
|
$dumpvars(0, tb_z3_demo_ice);
|
|
`endif
|
|
|
|
$display("==========================================================");
|
|
$display(" Palladium Z3 ICE Self-Check FSM Verification Start ");
|
|
$display("==========================================================");
|
|
|
|
#100;
|
|
rst_n = 1;
|
|
|
|
// Wait for FSM completion
|
|
@(posedge led_done);
|
|
#50;
|
|
|
|
$display("==========================================================");
|
|
$display(" [ICE Status] led_done=%b, led_pass=%b, led_fail=%b", led_done, led_pass, led_fail);
|
|
$display(" [ICE Status] led_gpio=0x%02X, led_irq=%b", led_gpio, led_irq);
|
|
if (led_pass && !led_fail) begin
|
|
$display("===> [PASS] ICE Self-Check FSM Passed Successfully!");
|
|
end else begin
|
|
$display("===> [FAIL] ICE Self-Check FSM Reported Failure!");
|
|
end
|
|
$display("==========================================================");
|
|
|
|
$finish;
|
|
end
|
|
|
|
initial begin
|
|
#50000;
|
|
$display("[TIMEOUT] ICE Simulation watchdog expired!");
|
|
$finish;
|
|
end
|
|
|
|
endmodule
|