[myhdl-list] Slicing an unsigned intbv to a signed one
Brought to you by:
jandecaluwe
From: Günter D. <dan...@we...> - 2008-06-10 12:21:47
|
Hi, I try to figure out whether there is a simple way to slice bits from an unsigned intbv and assign them to a signed intbv and have the msb of the slice specify the sign of the signed intbv? In addition to that it should be convertible with toVerilog/VHDL. For example, what I try to do is split up a 8 bit wide data word that is considered unsigned, that means min=0 and max=256, into two 4 bit wide data words with those being considered signed, meaning min=-8 max = 8. In Verilog that can be done using the $signed() system task. Is there a simple way to do that with myhdl? The problem I am running into is when the msb in the slice is set, that when assigning it to a signed intbv it is complaining that the value exceeds the max allowed value as the slice is considered a positive value. Thanks for the help. Cheers, Guenter |