U
unfrostedpoptart
Guest
Question for the group:
In many header files I've used, I've defined constants (typically
addresses) as parameters:
localparam [31:0] ADDRESS_A = 32'h1000_0004;
In case statements based on a subset of the parameter I am able to use
a part select ( ADDRESS_A[7:0]). However, in some other code I need
to import, the engineer is using macros:
`define ADDRESS_A 32'h1000_0004
But it's not legal to do a part-select on a literal
( `ADDRESS_A[7:0]). A workaround is to assign it first to a dummy
wire, but I was hoping for something more elegant. Any suggestions?
Why doesn't Verilog support this?
Thanks,
David
In many header files I've used, I've defined constants (typically
addresses) as parameters:
localparam [31:0] ADDRESS_A = 32'h1000_0004;
In case statements based on a subset of the parameter I am able to use
a part select ( ADDRESS_A[7:0]). However, in some other code I need
to import, the engineer is using macros:
`define ADDRESS_A 32'h1000_0004
But it's not legal to do a part-select on a literal
( `ADDRESS_A[7:0]). A workaround is to assign it first to a dummy
wire, but I was hoping for something more elegant. Any suggestions?
Why doesn't Verilog support this?
Thanks,
David