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
Labels
resolution: wontfix Closed; work won't continue on an issue or pull request type: feature-IEEE Request to add new feature, described in IEEE 1800

Comments

@veripoolbot
Copy link
Contributor


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
Copy link
Contributor Author


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
Copy link
Contributor Author


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
Copy link
Contributor Author


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....

@veripoolbot veripoolbot added resolution: wontfix Closed; work won't continue on an issue or pull request type: feature-IEEE Request to add new feature, described in IEEE 1800 labels Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: wontfix Closed; work won't continue on an issue or pull request type: feature-IEEE Request to add new feature, described in IEEE 1800
Projects
None yet
Development

No branches or pull requests

1 participant