新手上路
- 积分
- 27
- 金钱
- 27
- 注册时间
- 2019-3-11
- 在线时间
- 4 小时
|
5金钱
请问大家,我这段代码的35行 40行 45行 为输出变量sample_clk_out赋值的语句出了什么问题,总是提示 Illegal reference to net "sample_clk_out".这个错误
`timescale 1 ns/ 1 ps
module sample_clk_tb();
reg sys_clk;
reg sys_rst_n;
wire sample_clk_out;
parameter div_num1 = 12'd3570; //通过修æ”1分频数,修æ”1输å‡o的时钟频率
parameter div_num2 = 12'd3580; //通过修æ”1分频数,修æ”1输å‡o的时钟频率
reg [15:0] count; //计数器
parameter T = 10;
always #(T/2) sys_clk = ~sys_clk;
sample_clk i1 (
.sample_clk_out(sample_clk_out),
.sys_clk(sys_clk),
.sys_rst_n(sys_rst_n)
);
initial
begin
sys_clk = 1'b0;
sys_rst_n = 1'b0;
#(T/2) sys_rst_n = 1'b1;
#(7150*4*T) $stop;
$display("Running testbench");
end
always @(posedge sys_clk or negedge sys_rst_n) begin
if (!sys_rst_n) begin
count <= 16'd0;
sample_clk_out <= 1'b0;
end
else if (count < (div_num1-1)) begin //从0开始计数
count <= count+1;
sample_clk_out <= 1'b0;
end
else if (((div_num1-1) <= count) && (count < (div_num2-1))) begin
count <= count+1;
sample_clk_out <= 1'b1;
end
else begin
count <= 16'd0;
end
end
endmodule
|
|