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

fix to unbreak verilator compatability #157

Merged
merged 1 commit into from
Jun 5, 2024
Merged

Conversation

hhe07
Copy link

@hhe07 hhe07 commented Jun 3, 2024

move include / local parameter calculation to fix verilator compilation issue

error:

%Error: /home/hhe07/Documents/openrisc/litex/pythondata-cpu-mor1kx/pythondata_cpu_mor1kx/verilog/rtl/verilog/mor1kx_utils.vh:96:18: Constant function may not be declared under generate (IEEE 1800-2023 13.4.3)
                                                                                                                                  : ... note: In instance 'sim.mor1kx.mor1kx_cpu'
   96 | function integer calc_rf_addr_width;
      |                  ^~~~~~~~~~~~~~~~~~
        /home/hhe07/Documents/openrisc/litex/pythondata-cpu-mor1kx/pythondata_cpu_mor1kx/verilog/rtl/verilog/mor1kx_cpu.v:205:1: ... note: In file included from 'mor1kx_cpu.v'
%Error: /home/hhe07/Documents/openrisc/litex/pythondata-cpu-mor1kx/pythondata_cpu_mor1kx/verilog/rtl/verilog/mor1kx_cpu.v:205:37: Expecting expression to be constant, but can't determine constant for FUNCREF 'calc_rf_addr_width'
                                                                                                                                : ... note: In instance 'sim.mor1kx.mor1kx_cpu'
        /home/hhe07/Documents/openrisc/litex/pythondata-cpu-mor1kx/pythondata_cpu_mor1kx/verilog/rtl/verilog/mor1kx_utils.vh:96:18: ... Location of non-constant FUNC 'calc_rf_addr_width': Constant function called under generate
        /home/hhe07/Documents/openrisc/litex/pythondata-cpu-mor1kx/pythondata_cpu_mor1kx/verilog/rtl/verilog/mor1kx_cpu.v:205:37: ... Called from 'calc_rf_addr_width()' with parameters:
           rf_addr_width = ?32?h5
           rf_num_shadow_gpr = ?32?h0
  205 |          localparam RF_ADDR_WIDTH = calc_rf_addr_width(OPTION_RF_ADDR_WIDTH,
      |                                     ^~~~~~~~~~~~~~~~~~
%Error: Exiting due to 2 error(s)

@stffrdhrn
Copy link
Member

In the git commit message can you add the verilator error you are fixing?

@hhe07
Copy link
Author

hhe07 commented Jun 4, 2024

done

@stffrdhrn stffrdhrn merged commit 61540af into openrisc:master Jun 5, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants