I have a 4 bit number that I need to sign extend to say ‘WIDTH’ bits … I have read online some older banter but not sure out of that how to do this or if it is supported easily?
I can of course use an if then to test the bit and stuff ones/zeroes …the verilog version is simple (I suspect VHDL is similarly so)
rt <= {{WIDTH-4{instr[3]}}, instr[3:0]}; // using bit replication
I fell into the last condition, so I declared rt as Signed(intbv(0, -2**(WIDTH-1), 2**(WIDTH-1))) which made my rt as reg signed which is a great outcome and so used instr.signed() - thanks!