rahdirs
Advanced Member level 1
Hi,
I am multiplying two variables (16 bit) in verilog, so the maximum number of bits of the product is 32 bits. Is there any shortcut to assign the msb 16 bits to a variable ?
c will be assigned the 16 lsb bits, is there any shorter way of doing this without declaring a 32 bit variable as in,
I am multiplying two variables (16 bit) in verilog, so the maximum number of bits of the product is 32 bits. Is there any shortcut to assign the msb 16 bits to a variable ?
Code:
parameter a = 16'hABCD;
parameter b = 16'hFFFF;
wire [15:0] c;
assign c = a*b;
c will be assigned the 16 lsb bits, is there any shorter way of doing this without declaring a 32 bit variable as in,
Code:
wire [31:0] product
wire [15:0] c;
assign product = a*b;
assign c = product[31:16]