2024-02-23 13:01:05 +00:00
|
|
|
ARCHITECTURE studentVersion OF offsetToUnsigned IS
|
2024-03-15 13:03:21 +00:00
|
|
|
|
|
|
|
signal mySignal : unsigned(BitNb-1 downto 0);
|
|
|
|
signal const : unsigned(BitNb-1 downto 0) := (others => '1');
|
|
|
|
|
2024-02-23 13:01:05 +00:00
|
|
|
BEGIN
|
2024-03-15 13:03:21 +00:00
|
|
|
process(signedIn) begin
|
|
|
|
if signedIn(signedIn'high) then
|
|
|
|
mySignal <= unsigned(signedIn) - (const srl 1);
|
|
|
|
else
|
|
|
|
mySignal <= unsigned(signedIn) + (const srl 1);
|
|
|
|
end if;
|
|
|
|
end process;
|
|
|
|
|
|
|
|
unsignedOut <= mySignal;
|
|
|
|
|
2024-02-23 13:01:05 +00:00
|
|
|
END ARCHITECTURE studentVersion;
|