【问题标题】:having trouble with always block in verilog在verilog中总是阻塞有问题
【发布时间】:2016-12-21 10:07:43
【问题描述】:

我目前正在制作一款可以设置开始时间的手表,但始终@() 有问题

always @ (posedge clk or posedge reset or posedge sw3 or posedge sw4) begin
    if(reset == 1) begin //reset signal is not a pulse therefore this could do the thing needed for keep pressing the reset button
        tmp_second = 0;
        tmp_minute = 0;
        tmp_hour = 0;
    end

以上只是完整代码的一部分,其余部分是关于通过 sw3 和 sw4 设置时间但是当我尝试合成这个模块时 出现以下错误

ERROR:Xst:2089 - "first_mode.v" line 69: This sensitivity list construct will match none of the supported FF or Latch templates.

如果我改变了总是这样的块

always @ (posedge clk or posedge reset) begin

我没有收到错误消息,但我希望 posedge sw3 和 sw4 独立于 clk 工作

是否有任何方法可以使用始终阻止,包括那些 4

【问题讨论】:

  • 您应该从硬件角度考虑任何类型的 HDL 设计。硬件触发器有一个时钟(边沿敏感)和一个复位引脚。但是,在您的代码中,您为 always 块提供了多个边缘敏感信号,这就是合成器显示错误的原因。最好先画一些粗略的硬件,然后根据它进行编码。为什么需要posedge sw3posedge sw4,而不仅仅是sw3sw4

标签: verilog


【解决方案1】:

在合成时,坚持使用模板保持一致是明智之举。这是一个这样的模板,用于具有异步复位的时序逻辑,所有综合工具都应该理解:

always @(posedge CLOCK  or posedge RESET)  // or negedge
  begin
    // PUT NO CODE HERE
    if (RESET == 1'b1)  // or (RESET == 1'b0) for an active-low reset
      // set the variables driven by this always block to their reset values
      // MAKE SURE YOU USE NON-BLOCKING ASSIGNMENTS ( <= )
    else
      // do things that occur on the rising (or falling) edge of CLOCK
      // stuff here gets synthesised to combinational logic on the D input
      // of the resulting flip-flops
      // MAKE SURE YOU USE NON-BLOCKING ASSIGNMENTS ( <= )
end

这是没有异步重置的顺序过程的相应模板:

always @(posedge CLOCK)  // or negedge
  begin
    // do things that occur on the rising (or falling) edge of CLOCK
    // stuff here gets synthesised to combinational logic on the D input
    // of the resulting flip-flops
    // MAKE SURE YOU USE NON-BLOCKING ASSIGNMENTS ( <= )
end

最后,这里是组合逻辑的模板:

always @(*)
  begin
    // implement your combinational logic here
    // MAKE SURE YOU USE BLOCKING ASSIGNMENTS ( = )
end

您的代码不符合这三个模板中的任何一个或任何其他模板。这就是你合成工具看不懂的原因。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-24
    • 2015-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多