关于verilog请教下
module counter4(clk,dout,en,oc);input wire clk;
input wire en;
output reg dout;
output reg oc;
reg temp;
always @(posedge clk)
begin
if(en==1)
begin
temp<=temp+1;
if(temp=="1111")
oc<=1;
else
oc<=0;
dout<=temp; end
else
dout<=4'bz;
oc<="z";
end
endmodule
怎么进位信号老是没有呢!
请教下 你真是verilog大牛啊, 都可以这样子写:
if(temp=="1111")
难道编译的时候没有看报警信息吗? 你这个程序没有设计好,一个十六位的计数器。你没有考滤到复位的问题。我想你的那个进位没有分明白是同步还是异步。 没有报警信息
我只是想说为什么没有进位信号 if(temp== 4'b1111) 看完lz的程序,我的鼻血都出来了。
建议lz先从一些仿真库里找些现成的模块来改。
等改得多了,有感觉了,再自己构建。 楼主的程序写的很雷人。。呵呵 temp=="1111"
verilog里边的字符串是不能用于综合的 module counter4(clk,dout,en,oc);
input wire clk;
input wire en;
output reg dout;
output reg oc;
reg temp;
always @(posedge clk)
if(en==1)
begin
temp<=temp+1;
if(temp==4'b1111)
oc<=1;
else
oc<=0;
dout<=temp;
end
else
begin
dout<=4'bzzzz;
oc<="z";
end
endmodule
这会就对了,各位还有什么可以教导的么,受益匪浅 啊!!
学习了 我还是个初学者,还是自学的!!还请多多指教 大家都是一样的,相互帮助
页:
[1]