|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
代码功能如下:
fq_chs:通过不同的confg0,confg1,confg2选择输出的fq_out为频率略有差别的时钟信号。在一段时间内对fq_out进行计数输出
cnt_numb。
问题:1.代码风格有没有问题,如果有,怎么改进?
2.写testbench测试confg不同cnt_numb数值时,会出现一些未知的不定态,我问题出在哪?
fq_chs fq_chs(.ctrl(ctrl),.confg0(confg0),.confg1(confg1),
.confg2(confg2),.fq_out(fq_out));
always@(negedge cnt_rst or posedge clk_std)
begin
if(!cnt_rst)
std_numb <= 8'h0;
else
std_numb <= std_numb+1;
end
assign compare_out=(std_numb==8'h77)?1:0;
always@(negedge cnt_rst or posedge compare_out)
begin
if(!cnt_rst)
param<=0;
else
param<=1;
end
always@(negedge cnt_rst or posedge fq_out )
begin
if(!cnt_rst)
cnt_numb <= 8'h0;
else
if(param)
cnt_numb<=cnt_numb;
else
cnt_numb<=cnt_numb+1;
end |
|