feat: complete Palladium Z2 demo for both SA and ICE emulation flows
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// z2_demo_ice_top.v -- Palladium Z2 ICE-mode demo top
|
||||
//
|
||||
// ICE (In-Circuit Emulation) has NO software testbench: everything that runs
|
||||
// in the emulator must be hardware. This top therefore wraps the SAME DUT as
|
||||
// the SA demo (z2_demo_top) with a small synthesizable stimulus/checker FSM
|
||||
// that plays the role the SystemVerilog/Verilog TB played in SA mode:
|
||||
//
|
||||
// reset -> program LOAD/CMP -> read & check ID -> enable timer
|
||||
// -> wait for irq -> check STATUS flags -> check GPIO rotation
|
||||
// -> disable, W1C-clear flags, re-check -> PASS/FAIL LEDs
|
||||
//
|
||||
// Top-level pins (these are what ICE target/clock hookup sees):
|
||||
// clk_in design clock (from target or emulator clock configuration)
|
||||
// rst_n_in active-low reset
|
||||
// led_gpio mirrors DUT gpio_out (the rotating pattern)
|
||||
// led_irq mirrors DUT irq
|
||||
// led_done sequence finished
|
||||
// led_pass all hardware checks passed
|
||||
// led_fail a check failed (or irq timed out)
|
||||
// -----------------------------------------------------------------------------
|
||||
`timescale 1ns/1ps
|
||||
|
||||
module z2_demo_ice_top (
|
||||
input wire clk_in,
|
||||
input wire rst_n_in,
|
||||
output wire [7:0] led_gpio,
|
||||
output wire led_irq,
|
||||
output reg led_done,
|
||||
output reg led_pass,
|
||||
output reg led_fail
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------ DUT signals
|
||||
reg [7:0] paddr;
|
||||
reg psel;
|
||||
reg penable;
|
||||
reg pwrite;
|
||||
reg [31:0] pwdata;
|
||||
wire [31:0] prdata;
|
||||
wire pready;
|
||||
wire [7:0] gpio_out;
|
||||
wire irq;
|
||||
wire cmp_hit;
|
||||
|
||||
z2_demo_top dut (
|
||||
.clk (clk_in),
|
||||
.rst_n (rst_n_in),
|
||||
.paddr (paddr),
|
||||
.psel (psel),
|
||||
.penable (penable),
|
||||
.pwrite (pwrite),
|
||||
.pwdata (pwdata),
|
||||
.prdata (prdata),
|
||||
.pready (pready),
|
||||
.gpio_out (gpio_out),
|
||||
.irq (irq),
|
||||
.cmp_hit (cmp_hit)
|
||||
);
|
||||
|
||||
assign led_gpio = gpio_out;
|
||||
assign led_irq = irq;
|
||||
|
||||
// ------------------------------------------------------------ FSM
|
||||
localparam ST_WAIT = 5'd0;
|
||||
localparam ST_WR_LOAD = 5'd1;
|
||||
localparam ST_WR_CMP = 5'd2;
|
||||
localparam ST_RD_ID = 5'd3;
|
||||
localparam ST_CHK_ID = 5'd4;
|
||||
localparam ST_WR_CTRL = 5'd5;
|
||||
localparam ST_WAIT_IRQ = 5'd6;
|
||||
localparam ST_RD_STAT = 5'd7;
|
||||
localparam ST_CHK_STAT = 5'd8;
|
||||
localparam ST_RD_GPIO = 5'd9;
|
||||
localparam ST_CHK_GPIO = 5'd10;
|
||||
localparam ST_WR_CTRL0 = 5'd11;
|
||||
localparam ST_WR_W1C = 5'd12;
|
||||
localparam ST_RD_STAT2 = 5'd13;
|
||||
localparam ST_CHK_STAT2= 5'd14;
|
||||
localparam ST_PASS = 5'd15;
|
||||
localparam ST_FAIL = 5'd16;
|
||||
|
||||
reg [4:0] state;
|
||||
reg [15:0] wait_cnt;
|
||||
reg [31:0] rd_latched;
|
||||
|
||||
// Bus drive is combinational from the state: each WR/RD state lasts
|
||||
// exactly one clock, which is one full transaction for this DUT
|
||||
// (pready is constant 1 and writes are captured on the clock edge).
|
||||
always @(*) begin
|
||||
paddr = 8'd0;
|
||||
pwdata = 32'd0;
|
||||
pwrite = 1'b0;
|
||||
psel = 1'b0;
|
||||
penable = 1'b0;
|
||||
case (state)
|
||||
ST_WR_LOAD: begin psel=1; penable=1; pwrite=1; paddr=8'h04; pwdata=32'd19; end
|
||||
ST_WR_CMP: begin psel=1; penable=1; pwrite=1; paddr=8'h0C; pwdata=32'd5; end
|
||||
ST_RD_ID: begin psel=1; penable=1; pwrite=0; paddr=8'h18; end
|
||||
ST_WR_CTRL: begin psel=1; penable=1; pwrite=1; paddr=8'h00; pwdata=32'd7; end
|
||||
ST_RD_STAT: begin psel=1; penable=1; pwrite=0; paddr=8'h10; end
|
||||
ST_RD_GPIO: begin psel=1; penable=1; pwrite=0; paddr=8'h14; end
|
||||
ST_WR_CTRL0: begin psel=1; penable=1; pwrite=1; paddr=8'h00; pwdata=32'd0; end
|
||||
ST_WR_W1C: begin psel=1; penable=1; pwrite=1; paddr=8'h10; pwdata=32'd3; end
|
||||
ST_RD_STAT2: begin psel=1; penable=1; pwrite=0; paddr=8'h10; end
|
||||
default: ;
|
||||
endcase
|
||||
end
|
||||
|
||||
always @(posedge clk_in or negedge rst_n_in) begin
|
||||
if (!rst_n_in) begin
|
||||
state <= ST_WAIT;
|
||||
wait_cnt <= 16'd0;
|
||||
rd_latched <= 32'd0;
|
||||
led_done <= 1'b0;
|
||||
led_pass <= 1'b0;
|
||||
led_fail <= 1'b0;
|
||||
end else begin
|
||||
case (state)
|
||||
ST_WAIT: begin
|
||||
wait_cnt <= wait_cnt + 16'd1;
|
||||
if (wait_cnt >= 16'd7) state <= ST_WR_LOAD;
|
||||
end
|
||||
ST_WR_LOAD: state <= ST_WR_CMP;
|
||||
ST_WR_CMP: state <= ST_RD_ID;
|
||||
ST_RD_ID: begin rd_latched <= prdata; state <= ST_CHK_ID; end
|
||||
ST_CHK_ID: state <= (rd_latched == 32'h5A32_0001) ? ST_WR_CTRL : ST_FAIL;
|
||||
ST_WR_CTRL: begin wait_cnt <= 16'd0; state <= ST_WAIT_IRQ; end
|
||||
ST_WAIT_IRQ: begin
|
||||
wait_cnt <= wait_cnt + 16'd1;
|
||||
if (irq) state <= ST_RD_STAT;
|
||||
else if (wait_cnt > 16'd200) state <= ST_FAIL; // irq timeout guard
|
||||
end
|
||||
ST_RD_STAT: begin rd_latched <= prdata; state <= ST_CHK_STAT; end
|
||||
ST_CHK_STAT: state <= (rd_latched[1:0] == 2'b11) ? ST_RD_GPIO : ST_FAIL;
|
||||
ST_RD_GPIO: begin rd_latched <= prdata; state <= ST_CHK_GPIO; end
|
||||
ST_CHK_GPIO: state <= (rd_latched == 32'd2) ? ST_WR_CTRL0 : ST_FAIL;
|
||||
ST_WR_CTRL0: state <= ST_WR_W1C;
|
||||
ST_WR_W1C: state <= ST_RD_STAT2;
|
||||
ST_RD_STAT2: begin rd_latched <= prdata; state <= ST_CHK_STAT2; end
|
||||
ST_CHK_STAT2: state <= (rd_latched == 32'd0) ? ST_PASS : ST_FAIL;
|
||||
ST_PASS: begin led_done <= 1'b1; led_pass <= 1'b1; state <= ST_PASS; end
|
||||
ST_FAIL: begin led_done <= 1'b1; led_fail <= 1'b1; state <= ST_FAIL; end
|
||||
default: state <= ST_WAIT;
|
||||
endcase
|
||||
end
|
||||
end
|
||||
|
||||
wire _unused = &{1'b0, pready, cmp_hit};
|
||||
|
||||
endmodule
|
||||
@@ -0,0 +1,140 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// z2_demo_top.v -- Palladium Z2 emulation demo DUT
|
||||
//
|
||||
// A small, fully synthesizable, register-mapped timer peripheral used to
|
||||
// demonstrate the Palladium Z2 flow end to end:
|
||||
// IXCOM compile (SA mode) -> download with xeDebug -> run -> check results
|
||||
// The same RTL also runs in a plain event simulator (xrun / iverilog) with
|
||||
// the testbench in ../tb, so the logic can be verified before using hardware.
|
||||
//
|
||||
// Bus: APB-like (single-cycle ready). Only the low 8 address bits are decoded.
|
||||
//
|
||||
// Register map (byte addresses):
|
||||
// 0x00 CTRL [0]=enable [1]=irq_en [2]=pattern_en (RW)
|
||||
// 0x04 LOAD reload value of the down counter (RW)
|
||||
// 0x08 COUNT current counter value (RO)
|
||||
// 0x0C CMP compare value: pulse cmp_hit when COUNT==CMP (RW)
|
||||
// 0x10 STATUS [0]=timeout flag (W1C) [1]=cmp flag (W1C) (RW/RO)
|
||||
// 0x14 GPIO 8-bit rotating pattern output register (RW)
|
||||
// 0x18 ID constant 0x5A32_0001 (RO)
|
||||
//
|
||||
// Behaviour:
|
||||
// * When CTRL.enable=1, COUNT decrements every clock. When it reaches 0 it
|
||||
// sets STATUS.timeout, raises irq (if irq_en), and reloads from LOAD.
|
||||
// * When COUNT==CMP, STATUS.cmp is set and cmp_hit pulses for one cycle.
|
||||
// * When CTRL.pattern_en=1, GPIO rotates left by one bit on every timeout,
|
||||
// giving a visible "running light" to observe in xeDebug / waveforms.
|
||||
// -----------------------------------------------------------------------------
|
||||
`timescale 1ns/1ps
|
||||
|
||||
module z2_demo_top (
|
||||
input wire clk,
|
||||
input wire rst_n,
|
||||
// APB-like slave bus
|
||||
input wire [7:0] paddr,
|
||||
input wire psel,
|
||||
input wire penable,
|
||||
input wire pwrite,
|
||||
input wire [31:0] pwdata,
|
||||
output reg [31:0] prdata,
|
||||
output wire pready,
|
||||
// Observable outputs
|
||||
output wire [7:0] gpio_out,
|
||||
output wire irq,
|
||||
output wire cmp_hit
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------------ regs
|
||||
reg ctrl_enable;
|
||||
reg ctrl_irq_en;
|
||||
reg ctrl_pattern_en;
|
||||
reg [31:0] reg_load;
|
||||
reg [31:0] reg_count;
|
||||
reg [31:0] reg_cmp;
|
||||
reg status_timeout;
|
||||
reg status_cmp;
|
||||
reg [7:0] reg_gpio;
|
||||
|
||||
assign pready = 1'b1;
|
||||
assign gpio_out = reg_gpio;
|
||||
assign irq = status_timeout & ctrl_irq_en;
|
||||
|
||||
wire bus_write = psel & penable & pwrite;
|
||||
wire bus_read = psel & penable & ~pwrite;
|
||||
|
||||
wire timeout_now = ctrl_enable & (reg_count == 32'd0);
|
||||
assign cmp_hit = ctrl_enable & (reg_count == reg_cmp);
|
||||
|
||||
// ------------------------------------------------------------- write path
|
||||
always @(posedge clk or negedge rst_n) begin
|
||||
if (!rst_n) begin
|
||||
ctrl_enable <= 1'b0;
|
||||
ctrl_irq_en <= 1'b0;
|
||||
ctrl_pattern_en <= 1'b0;
|
||||
reg_load <= 32'd9; // default period: 10 cycles
|
||||
reg_cmp <= 32'd3;
|
||||
reg_gpio <= 8'h01;
|
||||
status_timeout <= 1'b0;
|
||||
status_cmp <= 1'b0;
|
||||
end else begin
|
||||
// sticky flags: set by hardware events, cleared by W1C writes
|
||||
if (timeout_now) status_timeout <= 1'b1;
|
||||
if (cmp_hit) status_cmp <= 1'b1;
|
||||
|
||||
if (bus_write) begin
|
||||
case (paddr)
|
||||
8'h00: begin
|
||||
ctrl_enable <= pwdata[0];
|
||||
ctrl_irq_en <= pwdata[1];
|
||||
ctrl_pattern_en <= pwdata[2];
|
||||
end
|
||||
8'h04: reg_load <= pwdata;
|
||||
8'h0C: reg_cmp <= pwdata;
|
||||
8'h10: begin // STATUS: write-1-to-clear
|
||||
if (pwdata[0]) status_timeout <= 1'b0;
|
||||
if (pwdata[1]) status_cmp <= 1'b0;
|
||||
end
|
||||
8'h14: reg_gpio <= pwdata[7:0];
|
||||
default: ;
|
||||
endcase
|
||||
end
|
||||
|
||||
// pattern rotation on timeout (software write same cycle wins
|
||||
// for reg_gpio because this block is separate; see count block)
|
||||
if (timeout_now & ctrl_pattern_en & ~(bus_write & (paddr == 8'h14)))
|
||||
reg_gpio <= {reg_gpio[6:0], reg_gpio[7]};
|
||||
end
|
||||
end
|
||||
|
||||
// ------------------------------------------------------------- count path
|
||||
always @(posedge clk or negedge rst_n) begin
|
||||
if (!rst_n) begin
|
||||
reg_count <= 32'd9;
|
||||
end else if (bus_write & (paddr == 8'h04)) begin
|
||||
reg_count <= pwdata; // writing LOAD also presets COUNT
|
||||
end else if (ctrl_enable) begin
|
||||
if (reg_count == 32'd0)
|
||||
reg_count <= reg_load; // reload
|
||||
else
|
||||
reg_count <= reg_count - 32'd1;
|
||||
end
|
||||
end
|
||||
|
||||
// -------------------------------------------------------------- read path
|
||||
always @(*) begin
|
||||
case (paddr)
|
||||
8'h00: prdata = {29'd0, ctrl_pattern_en, ctrl_irq_en, ctrl_enable};
|
||||
8'h04: prdata = reg_load;
|
||||
8'h08: prdata = reg_count;
|
||||
8'h0C: prdata = reg_cmp;
|
||||
8'h10: prdata = {30'd0, status_cmp, status_timeout};
|
||||
8'h14: prdata = {24'd0, reg_gpio};
|
||||
8'h18: prdata = 32'h5A32_0001; // ID
|
||||
default: prdata = 32'd0;
|
||||
endcase
|
||||
end
|
||||
|
||||
// keep bus_read referenced (used by assertions in TB via hierarchy)
|
||||
wire _unused = &{1'b0, bus_read};
|
||||
|
||||
endmodule
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
# =============================================================================
|
||||
# compile_ice.sh -- Palladium Z2 ICE 模式硬件编译脚本
|
||||
#
|
||||
# 原理说明:
|
||||
# 通过 Cadence IXCOM 统一前端调用 -ua +dut+z2_demo_ice_top,触发后端 AVS / xeCompile
|
||||
# 对顶层模块进行全硬件逻辑综合、关键路径分析,并将网表映射进 Palladium Z2 物理机台。
|
||||
#
|
||||
# 使用方式:
|
||||
# XE_HOST=scz2_emu XE_BOARDS=18.0 ./ice/scripts/compile_ice.sh
|
||||
# =============================================================================
|
||||
set -e
|
||||
cd "$(dirname "$0")/../.." # 切到工程根目录
|
||||
ROOT="$(pwd)"
|
||||
|
||||
export XE_HOST="${XE_HOST:-scz2_emu}"
|
||||
export XE_BOARDS="${XE_BOARDS:-18.0}"
|
||||
|
||||
echo "======================================================================"
|
||||
echo " [Palladium Z2 ICE] 开始编译硬件设计"
|
||||
echo " Target Host : $XE_HOST"
|
||||
echo " Target Boards : $XE_BOARDS"
|
||||
echo " Top Module : z2_demo_ice_top"
|
||||
echo "======================================================================"
|
||||
|
||||
set +e
|
||||
ixcom -clean -ua +dut+z2_demo_ice_top \
|
||||
"$ROOT/ice/rtl/z2_demo_top.v" \
|
||||
"$ROOT/ice/rtl/z2_demo_ice_top.v" \
|
||||
> compile_ice.log 2>&1
|
||||
rc=$?
|
||||
set -e
|
||||
cat compile_ice.log
|
||||
|
||||
if [ $rc -ne 0 ] || grep -q -E '\*E,|ERROR|FATAL|FLOW_FAILED' compile_ice.log; then
|
||||
echo "======================================================================"
|
||||
echo " [FAIL] IXCOM ICE 编译失败 (rc=$rc)!请查看日志: compile_ice.log"
|
||||
echo "======================================================================"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "======================================================================"
|
||||
echo " [SUCCESS] Palladium Z2 ICE 硬件编译成功!"
|
||||
echo " 编译产物已生成: AxisWork / xc_work (含 xeCompile 网表与 Signature)"
|
||||
echo " 下一步: 执行 xeDebug 进行上机运行与状态机自检"
|
||||
echo "======================================================================"
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# run_local_ice.sh -- Verify the ICE top (stimulus FSM + DUT) without hardware.
|
||||
# Expected: sequence finishes, led_pass=1, led_gpio=0x02, "ICE LOCAL TEST PASSED".
|
||||
set -e
|
||||
cd "$(dirname "$0")/../.."
|
||||
mkdir -p ice/sim_local
|
||||
iverilog -g2005 -o ice/sim_local/z2_demo_ice.vvp \
|
||||
ice/rtl/z2_demo_top.v ice/rtl/z2_demo_ice_top.v ice/tb/tb_z2_demo_ice.v
|
||||
vvp ice/sim_local/z2_demo_ice.vvp | tee ice/sim_local/ice_run.log
|
||||
grep -q "ICE LOCAL TEST PASSED" ice/sim_local/ice_run.log \
|
||||
&& echo "== ICE LOCAL RUN: PASS ==" || { echo "== ICE LOCAL RUN: FAIL =="; exit 1; }
|
||||
@@ -0,0 +1,74 @@
|
||||
# =============================================================================
|
||||
# run_xedebug_ice.tcl -- Palladium Z2 ICE 模式上机下载与调试运行脚本
|
||||
#
|
||||
# 使用方式:
|
||||
# 在工程根目录下执行:
|
||||
# xeDebug -f ice/scripts/run_xedebug_ice.tcl
|
||||
# 或者启动交互界面后手动执行:
|
||||
# xeDebug
|
||||
# XE> source ice/scripts/run_xedebug_ice.tcl
|
||||
# =============================================================================
|
||||
|
||||
# 1) 载入当前硬件设计签名并连接目标 Palladium Z2 Emulator
|
||||
debug .
|
||||
|
||||
if {[info exists env(XE_HOST)]} {
|
||||
host $env(XE_HOST)
|
||||
} elseif {[info exists env(XE_HOSTNAME)]} {
|
||||
host $env(XE_HOSTNAME)
|
||||
} else {
|
||||
host scz2_emu
|
||||
}
|
||||
|
||||
# 2) 下载比特流到硬件机台 (xc on / download 兼容处理)
|
||||
if {[catch {xc on} err]} {
|
||||
catch {download}
|
||||
}
|
||||
|
||||
# 3) 复位激励时序:拉低复位 -> 跑 20 个时钟周期 -> 释放复位
|
||||
catch {force z2_demo_ice_top.rst_n_in 0}
|
||||
run 20
|
||||
catch {force z2_demo_ice_top.rst_n_in 1}
|
||||
|
||||
# 4) 运行时钟推進激励(自检状态机大约在 45 个周期内完成检查并挂起)
|
||||
run 1000
|
||||
|
||||
# 5) 提取并展示 LED 输出判读结果
|
||||
puts ""
|
||||
puts "======================================================="
|
||||
puts " Palladium Z2 ICE 运行测试结果 "
|
||||
puts "======================================================="
|
||||
|
||||
set done 0
|
||||
set pass 0
|
||||
set fail 0
|
||||
set gpio "??"
|
||||
|
||||
# 兼容 get 与 value 命令
|
||||
if {![catch {get -radix bin z2_demo_ice_top.led_done} val]} {
|
||||
set done $val
|
||||
set pass [get -radix bin z2_demo_ice_top.led_pass]
|
||||
set fail [get -radix bin z2_demo_ice_top.led_fail]
|
||||
set gpio [get -radix hex z2_demo_ice_top.led_gpio]
|
||||
} elseif {![catch {value z2_demo_ice_top.led_done} val]} {
|
||||
set done $val
|
||||
catch {set pass [value z2_demo_ice_top.led_pass]}
|
||||
catch {set fail [value z2_demo_ice_top.led_fail]}
|
||||
catch {set gpio [value z2_demo_ice_top.led_gpio]}
|
||||
}
|
||||
|
||||
puts " led_done : $done (测试序列是否完成,预期: 1)"
|
||||
puts " led_pass : $pass (全硬件检查是否通过,预期: 1)"
|
||||
puts " led_fail : $fail (是否有硬件检查失败,预期: 0)"
|
||||
puts " led_gpio : 0x$gpio (跑马灯寄存器旋转值,预期: 0x02)"
|
||||
puts "-------------------------------------------------------"
|
||||
|
||||
if {$pass == 1 && $fail == 0} {
|
||||
puts " >>> [SUCCESS] ICE DEMO 全部硬件自检测试通过! <<<"
|
||||
} else {
|
||||
puts " >>> [FAIL] ICE DEMO 硬件检查未通过,请排查状态机停滞位置 <<<"
|
||||
catch {puts " FSM State : [get -radix dec z2_demo_ice_top.state]"}
|
||||
catch {puts " Last Latched: 0x[get -radix hex z2_demo_ice_top.rd_latched]"}
|
||||
}
|
||||
puts "======================================================="
|
||||
puts ""
|
||||
@@ -0,0 +1,72 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// tb_z2_demo_ice.v -- Local-only bench for the ICE top.
|
||||
// In real ICE mode there is no testbench at all: clk/rst come from the target
|
||||
// or emulator clock setup and the result is the PASS/FAIL LEDs. This bench
|
||||
// only supplies clock/reset locally and watches the LEDs, so the stimulus
|
||||
// FSM itself can be verified before an ICE compile.
|
||||
// -----------------------------------------------------------------------------
|
||||
`timescale 1ns/1ps
|
||||
|
||||
module tb_z2_demo_ice;
|
||||
reg clk;
|
||||
reg rst_n;
|
||||
wire [7:0] led_gpio;
|
||||
wire led_irq;
|
||||
wire led_done;
|
||||
wire led_pass;
|
||||
wire led_fail;
|
||||
integer cycles;
|
||||
integer errors;
|
||||
|
||||
z2_demo_ice_top 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)
|
||||
);
|
||||
|
||||
initial clk = 1'b0;
|
||||
always #5 clk = ~clk;
|
||||
|
||||
initial begin
|
||||
$dumpfile("ice/sim_local/z2_demo_ice.vcd");
|
||||
$dumpvars(0, tb_z2_demo_ice);
|
||||
errors = 0;
|
||||
rst_n = 1'b0;
|
||||
repeat (4) @(negedge clk);
|
||||
rst_n = 1'b1;
|
||||
|
||||
// wait for the hardware sequence to finish (guard: 1000 cycles)
|
||||
cycles = 0;
|
||||
while (!led_done && cycles < 1000) begin
|
||||
@(negedge clk);
|
||||
cycles = cycles + 1;
|
||||
end
|
||||
|
||||
if (!led_done) begin
|
||||
$display("CHECK FAIL : ICE sequence did not finish in 1000 cycles");
|
||||
errors = errors + 1;
|
||||
end else begin
|
||||
$display("CHECK OK : ICE sequence finished in %0d cycles", cycles);
|
||||
end
|
||||
if (led_pass && !led_fail)
|
||||
$display("CHECK OK : led_pass=1 led_fail=0");
|
||||
else begin
|
||||
$display("CHECK FAIL : led_pass=%b led_fail=%b", led_pass, led_fail);
|
||||
errors = errors + 1;
|
||||
end
|
||||
if (led_gpio === 8'h02)
|
||||
$display("CHECK OK : led_gpio pattern = 0x02 (rotated once)");
|
||||
else begin
|
||||
$display("CHECK FAIL : led_gpio = 0x%02h, expected 0x02", led_gpio);
|
||||
errors = errors + 1;
|
||||
end
|
||||
|
||||
if (errors == 0) $display("ICE LOCAL TEST PASSED");
|
||||
else $display("ICE LOCAL TEST FAILED (%0d)", errors);
|
||||
$finish;
|
||||
end
|
||||
endmodule
|
||||
Reference in New Issue
Block a user