RoaLogic / plic

Platform Level Interrupt Controller
Other
34 stars 14 forks source link

Icarus Verilog Support; #11

Closed PedroAntunes178 closed 1 year ago

PedroAntunes178 commented 2 years ago

Hi, I'm trying to integrate the PLIC core in a project and would like to simulate with Icarus (although not required). One of the problems I encountered was that Icarus does not understand the key word always_comb in line 629/636 of the plic_dynamic_registers.sv file. I have changed always_combalways @(r,s) and it might have solved the problem. Since I am able to run a simulation with verilator and the outcome seems to be the same. What do you think?

Other problems that do not allow running Icarus Verilog simulation are:

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:608: debug: No generate items found
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:608: debug: No generate items found
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:608: debug: No generate items found
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392: error: Type names are not valid expressions here.
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392: internal error: I do not know how to elaborate this expression. 
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392:               : Expression is: <type>
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392:               : Expression type: 10PETypename
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392: error: Dimensions must be constant.
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392       : This size expression violates the rule: <type>
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:394: warning: ignoring out of bounds l-value array access name_array[1].
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:395: warning: ignoring out of bounds l-value array access name_array[2].
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:396: warning: ignoring out of bounds l-value array access name_array[3].
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:397: warning: ignoring out of bounds l-value array access name_array[4].
../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:398: warning: ignoring out of bounds l-value array access name_array[5].
../../../submodules/PLIC/hardware/src/iob_plic.v:113: assert: elaborate.cc:1652: failed assertion prts[0]->unpacked_dimensions()==0
Aborted
rherveille commented 2 years ago

always_comb is a new SystemVerilog construct. It tells the simulator/compiler that the code block is combinatorial (vs. registered/flipflop). It enables some additional checks in some simulators/compilers. You can replace it by always @*, or a traditional always @(). If your change works without issues, then I guess it’s correct.

The other errors seem to be an Icarus limitation. I know that Icarus Verilog has limited SystemVerilog support. The PLIC uses quite advanced constructs to dynamically generate the registers. Last time I tried Icarus, it did have troubles elaborating the design.

Richard

From: Pedro Antunes @.> Date: Friday, 2 September 2022 at 13:14 To: RoaLogic/plic @.> Cc: Subscribed @.***> Subject: [RoaLogic/plic] Icarus Verilog Support; (Issue #11)

Hi, I'm trying to integrate the PLIC core in a project and would like to simulate with Icarus (although it is not mandatory). One of the problems I encountered was that Icarus does not understand the key word always_comb in line 630/637 of the plic_dynamic_registers.sv file. I have changed always_comb → always @(r,s) and it might have solved the problem. Since I am able to run a simulation with verilator and the outcome seems to be the same. What do you think?

Other problems that do not allow running Icarus Verilog simulation are:

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:608: debug: No generate items found

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:608: debug: No generate items found

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:608: debug: No generate items found

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392: error: Type names are not valid expressions here.

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392: internal error: I do not know how to elaborate this expression.

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392: : Expression is:

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392: : Expression type: 10PETypename

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392: error: Dimensions must be constant.

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:392 : This size expression violates the rule:

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:394: warning: ignoring out of bounds l-value array access name_array[1].

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:395: warning: ignoring out of bounds l-value array access name_array[2].

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:396: warning: ignoring out of bounds l-value array access name_array[3].

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:397: warning: ignoring out of bounds l-value array access name_array[4].

../../../submodules/PLIC/hardware/src/plic_dynamic_registers.sv:398: warning: ignoring out of bounds l-value array access name_array[5].

../../../submodules/PLIC/hardware/src/iob_plic.v:113: assert: elaborate.cc:1652: failed assertion prts[0]->unpacked_dimensions()==0

Aborted

— Reply to this email directly, view it on GitHubhttps://github.com/RoaLogic/plic/issues/11, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADYKSCPFBI6BAXENBNUZTPTV4HORBANCNFSM6AAAAAAQDFXMVI. You are receiving this because you are subscribed to this thread.Message ID: @.***>