joice sar
Newbie level 4
- Joined
- Jan 9, 2013
- Messages
- 5
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,312
Please anyone give me an example of resize function in vhdl
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function RESIZE (ARG: SIGNED; NEW_SIZE: NATURAL) return SIGNED is
alias invec : SIGNED (ARG'length-1 downto 0) is ARG ;
variable RESULT: SIGNED (NEW_SIZE-1 downto 0) ;
constant bound : NATURAL:= MIN(ARG'length,RESULT'length)-2 ;
begin
if (NEW_SIZE<1) then return NAS; end if;
RESULT:= (others=>ARG(ARG'left)) ;
if bound >= 0 then
RESULT(bound downto 0) := invec(bound downto 0) ;
end if;
return RESULT;
end RESIZE ;