Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scr1 test suite: SystemVerilog nested @ blocks are not supported #1287

Closed
veripoolbot opened this issue Mar 8, 2018 · 3 comments
Closed

scr1 test suite: SystemVerilog nested @ blocks are not supported #1287

veripoolbot opened this issue Mar 8, 2018 · 3 comments

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Mar 8, 2018


Author Name: Joel Holdsworth
Original Redmine Issue: 1287 from https://www.veripool.org


The follow SystemVerilog code fails to parse...

module test(input clk);

initial begin
  @(posedge clk) begin
     $display("TEST");
  end
end

endmodule

...with the following error...

%Error: test_nested_at_block.sv:5: syntax error, unexpected '@'
%Error: Cannot continue
%Error: Command Failed /usr/local/bin/verilator_bin -sv --cc test_nested_at_block.sv

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Mar 9, 2018


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-03-09T04:50:44Z


Keeping open in case I'm misunderstanding what is needed...

Verilator is not an event based simulator and requires always blocks to be synthesizable, that is remove them from the initial block. This is unlikely to get fixed even in the medium term as is a fundamental rewrite.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Mar 9, 2018


Original Redmine Comment
Author Name: Joel Holdsworth
Original Date: 2018-03-09T17:06:04Z


Makes sense.

So here is the relevant code: https://github.com/syntacore/scr1/blob/master/src/tb/scr1_top_tb_ahb.sv#L104

Basically it reads test programs into the simulated memory, runs the CPU, until it halts, and logs the results.

Is there a way that this could be rewritten and maintain compatibility with the other simulators supported by this test-bench: ModelSim, Cadence, NCSim?

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Mar 9, 2018


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-03-09T20:05:06Z


Turn it into a FSM, e.g.

int load_state;
initial begin
    load_state = 0;
    loader();
end
always @ (posedge_clk) loader();

task loader();
    if (load_state==0) begin
        stuff in existing initial block, e.g. open file
        if (need possedge loop) load_state = 1;
        else load_state = 2;  // May fallthru to below if
    end
    else if (load_state==1) begin
        stuff after posedge
        if end_of_posedge_loop load_state = 2;
    end
    // May have been set to 2 directly above 
    if (load_state==2) begin
        stuff to close file
    end

Of course many other ways to do something similar....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.