M
mjl296@hotmail.com
Guest
Hi Guys,
Assigning values to signals of parameterisable width has always bugged
me. Assigning all zeros and all ones is easy, but assigning a given
value is a pain.
------------------------------------
parameter SIZE = 8;
// These assignments are fine
wire [SIZE-1:0] all_zeros = {SIZE{1'b0}};
wire [SIZE-1:0] all_ones = {SIZE{1'b1}};
// This one is messy
wire [SIZE-1:0] one = {{SIZE-1{1'b0}, 1'b1};
// Sadly, the following doesn't work
// wire [SIZE-1:0] one = SIZE'd1;
------------------------------------
Is there a better way?
Thanks,
Mark
Assigning values to signals of parameterisable width has always bugged
me. Assigning all zeros and all ones is easy, but assigning a given
value is a pain.
------------------------------------
parameter SIZE = 8;
// These assignments are fine
wire [SIZE-1:0] all_zeros = {SIZE{1'b0}};
wire [SIZE-1:0] all_ones = {SIZE{1'b1}};
// This one is messy
wire [SIZE-1:0] one = {{SIZE-1{1'b0}, 1'b1};
// Sadly, the following doesn't work
// wire [SIZE-1:0] one = SIZE'd1;
------------------------------------
Is there a better way?
Thanks,
Mark