Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

How could I use other ways to achieve the fork join statement

Added by Zhiyuan Ning 10 months ago

The verilator will throw an error when I use the fork and join statement. For example:
always begin
 in.receive();

  gPD1.tPD();
  out1.send();    

  gPD2.tPD();
  out2.send();

end    
However, if I can't use the fork statements, how could I make sure the out1.send() and out2.send() could be executed and reached at the same time that could be executed by verilator?

Replies (1)

RE: How could I use other ways to achieve the fork join statement - Added by Wilson Snyder 10 months ago

The problem here isn't likely the fork/join but that I think the implication from your question is that your receive/send tasks take multiple cycles. This isn't allowed in Verilator, instead have them use a FSM to send. e.g. a top FSM then lower fsm, just as you would write it if you were synthesizing the logic.

always @ (posedge clk) begin
  // Or, just have the always loop in the in1 etc module
  in1.cycle();
  out1.cycle();
  out2.cycle();
end

always @* begin
 if (in1.received()) begin
  out1.send_start();    
  out2.send_start();
 end
end 

module in1;
  int state;  // FSM state (better to use an enum with state names)
  task cycle;
    case (state)
      1: if (got_char) ... change state to 2 etc
      ...
    endcase
  endtask
  function in1;
    return state==2;
  endfunction
end
    (1-1/1)