Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
501 views
in Technique[技术] by (71.8m points)

having trouble with always block in verilog

I'm currently making a watch that we can set times to start and having a problem with always@()

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

the above is just a part of the full code and the rest of it is about setting the time by sw3 and sw4 but when I try to Synthesize this module the following Error comes up

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

if I change the always block like

always @ (posedge clk or posedge reset) begin

I dont get the error message but I want posedge sw3 and sw4 to work independently from clk

would there be any way to use always block including those 4

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When synthesising, it is wise to be consistent by sticking to a template. Here is one such template for sequential logic with an asynchronous reset, which all synthesis tools should understand:

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

Here is the corresponding template for a sequential process without an asynchronous reset:

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

And finally, here is the template for combinational logic:

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

Your code does not comform to any of these three templates nor any other. That is why you synthesis tool doesn't understand it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...