Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

resize function with example

Status
Not open for further replies.
numeric_std has resize functions for signed and unsigned types.

here is the resize function for signed types

Code:
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 ;
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top