2024-02-23 13:01:05 +00:00
|
|
|
ARCHITECTURE studentVersion OF resizer IS
|
2024-03-05 10:48:52 +00:00
|
|
|
|
|
|
|
signal mySignal : unsigned(outputBitNb-1 downto 0);
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
2024-02-23 13:01:05 +00:00
|
|
|
BEGIN
|
2024-03-05 10:48:52 +00:00
|
|
|
|
|
|
|
INPUT_BIGGER: if inputBitNb >= outputBitNb generate
|
|
|
|
process(resizeIn)
|
|
|
|
begin
|
|
|
|
mySignal <= resize(shift_right(resizeIn, inputBitNb - outputBitNb), outputBitNb);
|
|
|
|
end process;
|
|
|
|
end generate INPUT_BIGGER;
|
|
|
|
|
|
|
|
OUTPUT_BIGGER: if inputBitNb <= outputBitNb generate
|
|
|
|
process(resizeIn)
|
|
|
|
begin
|
|
|
|
mySignal <= shift_left(resize(resizeIn, outputBitNb), outputBitNb - inputBitNb);
|
|
|
|
end process;
|
|
|
|
end generate OUTPUT_BIGGER;
|
|
|
|
|
|
|
|
resizeOut <= mySignal;
|
|
|
|
|
2024-02-23 13:01:05 +00:00
|
|
|
END ARCHITECTURE studentVersion;
|