|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
一个计数器:
module counter_fiv(clk,rst,start0,counter_out);
input clk,rst;
input start0;
output [5:0] counter_out;
reg [5:0] counter_out;
reg [5:0] counter_m;
wire temp;
assign temp = !rst | !start0 ;
always @ (posedge clk or negedge rst) begin
if (temp)
counter_m <= 6'd0;
else
counter_m <=counter_m +1'b1;
end
always @ (counter_m) counter_out = counter_m;
endmodule
----------------------------------------------------
ERROR:Xst:899 - "../counter_fiv.v" line 15: The logic for <counter_m> does not match a known FF or Latch template. The description style you are using to describe a register or latch is not supported in the current software release.
------------------------------------------------------
还有一个问题,有点困扰,就是,可综合的模块不允许在两个always模块里面给同一个寄存器赋值,可是又不允许在敏感表中同时列举沿触发和电平触发。。那怎么写呢。。
比如这个计数器,我想有一个外部开关来控制启动与否,用start0来表示,start0=1时启动,start0=0时关闭。那start0和posedge clk之间怎么写呢,把start0写在posedge里面,肯定不是本意;可是写在外面,单独用一个always块写又不可综合,是不是要用assign来连接start0和counter_m呢?。。。
求教。。。 |
|