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

[rtl] fix natural condition #665

Merged
merged 3 commits into from
Aug 5, 2023

Conversation

NikLeberg
Copy link
Collaborator

Commit #41eec5a introduced an error for me when synthesizing with Quartus or simulating with ModelSim/QuestaSim.

QuestaSim:

# ** Error: ../lib/neorv32/rtl/core/neorv32_cpu_control.vhd(136): (vopt-1144) Value -32 (of type std.STANDARD.NATURAL) is out of range 0 to 2147483647.

Quartus:

Error (10528): VHDL error at neorv32_cpu_control.vhd(136): value "-32" is outside the target constraint range (0 to 2147483647) File: /workspaces/neorv32_soc/lib/neorv32/rtl/core/neorv32_cpu_control.vhd Line: 136
Error (10346): VHDL error at neorv32_package.vhd(1081): formal port or parameter "val_t" must have actual or default value File: /workspaces/neorv32_soc/lib/neorv32/rtl/core/neorv32_package.vhd Line: 1081
Error (10657): VHDL Subprogram error at neorv32_cpu_control.vhd(136):  failed to elaborate call to subprogram "cond_sel_natural_f" File: /workspaces/neorv32_soc/lib/neorv32/rtl/core/neorv32_cpu_control.vhd Line: 136
Error (12152): Can't elaborate user hierarchy "neorv32_cpu_smp:neorv32_cpu_smp_inst|neorv32_cpu:\neorv32_cpu_gen:0:neorv32_cpu_inst|neorv32_cpu_control:neorv32_cpu_control_inst" File: /workspaces/neorv32_soc/lib/neorv32/rtl/core/neorv32_cpu.vhd Line: 198

More specifically in neorv32_cpu_control.vhd#L136 the literal HPM_CNT_WIDTH-32 evaluates to -32 if no HPMs are enabled and is no longer a valid natural type.

I've added a quick fix for this by introducing a cond_sel_int_f function (hasn't that been there some time ago 🤔?). Fix works for me.

@stnolting
Copy link
Owner

Thanks for fixing!

@stnolting stnolting added bug Something isn't working as expected HW Hardware-related labels Aug 5, 2023
@stnolting stnolting merged commit 6863fd9 into stnolting:main Aug 5, 2023
5 checks passed
@NikLeberg NikLeberg deleted the fix-natural-condition branch August 5, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected HW Hardware-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants