Verilog单步调试:
System Verilog进行单步调试的步骤如下:
1. 编译设计
使用`-debug_all`或`-debug_pp`选项编译设计,生成调试信息。
我的4个文件:
1.led.v
module led(
input clk,
input rst_n,
output reg led
);
reg [7:0] cnt;
always @ (posedge clk)
begin
if(!rst_n)
cnt <= 0;
else if(cnt >= 10)
cnt <= 0;
else
cnt <= cnt + 1;
end
always @ (posedge clk)
begin
if(!rst_n)
led <= 0;
else if(cnt == 10)
led <= !led;
end
endmodule
2.led_tb.v
`timescale 1ns / 1ps
module led_tb;
// Parameters
parameter CLK_PERIOD = 10; // Clock period in ns
// Inputs
reg clk;
reg rst_n;
// Outputs
wire led;
// Instantiate the Unit Under Test (UUT)
led uut (
.clk(clk),
.rst_n(rst_n),
.led(led)
);
// Clock generation
initial begin
cl