likewise
Newbie level 5
Hello,
I would like to use constants in my SystemVerilog design for synthesis, which allow me to define values with a bit of arithmetic like this:
However, I understand that constants are not immediately available at start at runtime.
What exactly does this mean? When *are* they available and how can I use these constants safely?
Here is an example source code, which I try to compile stand-alone using Quartus:
and below are the critical warnings that Quartus gives.
They tell that c is never read, but my intent is a = b + c;
Also, I would expect c to be 8, but it is 0 (fully tied to GND)
Regards,
Leon.
I would like to use constants in my SystemVerilog design for synthesis, which allow me to define values with a bit of arithmetic like this:
Code Verilog - [expand] 1 2 3 const mytype_t R = (M + (N << 1)) / (1 + (N << 1)) + 1; const mytype_t RF = (R + 2**5) / 2**6; const mytype_t RF = RF > 2? RF: 2;
However, I understand that constants are not immediately available at start at runtime.
What exactly does this mean? When *are* they available and how can I use these constants safely?
Here is an example source code, which I try to compile stand-alone using Quartus:
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 const logic [7:0] c = 8; module systemverilogconst(clk, rstn, a, b); input logic clk; input logic rstn; input logic [7:0] a; output logic [7:0] b; logic [7:0] b_next; always_comb begin b_next = a + c; end always_ff @(posedge clk or negedge rstn) begin // asynchronous reset? if (~rstn) begin b <= '0; end // clock rising edge else begin b <= b_next; end end endmodule
and below are the critical warnings that Quartus gives.
They tell that c is never read, but my intent is a = b + c;
Also, I would expect c to be 8, but it is 0 (fully tied to GND)
Code:
Warning (10036): Verilog HDL or VHDL warning at systemverilogconst.sv(1): object "c" assigned a value but never read
Critical Warning (35046): Net "work.work.c_0_" has a missing source. The net will be connected to GND and its default value will be ignored.
Critical Warning (35046): Net "work.work.c_1_" has a missing source. The net will be connected to GND and its default value will be ignored.
Critical Warning (35046): Net "work.work.c_2_" has a missing source. The net will be connected to GND and its default value will be ignored.
Critical Warning (35046): Net "work.work.c_3_" has a missing source. The net will be connected to GND and its default value will be ignored.
Critical Warning (35046): Net "work.work.c_4_" has a missing source. The net will be connected to GND and its default value will be ignored.
Critical Warning (35046): Net "work.work.c_5_" has a missing source. The net will be connected to GND and its default value will be ignored.
Critical Warning (35046): Net "work.work.c_6_" has a missing source. The net will be connected to GND and its default value will be ignored.
Critical Warning (35046): Net "work.work.c_7_" has a missing source. The net will be connected to GND and its default value will be ignored.
Regards,
Leon.
Last edited: