



















Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!




















Descrizione di half adder ed or library IEEE; use ieee.std_logic_1164.all; entity halfAdder is port (a,b : in std_logic; s, cout: out std_logic); end entity halfAdder; architecture dataflow of halfAdder is begin cout <= a and b; s <= a xor b; end architecture dataflow; library IEEE; use ieee.std_logic_1164.all; entity orgate is port (a,b : in std_logic; y: out std_logic); end entity orgate; architecture dataflow of orgate is begin y <= a or b; end architecture dataflow;
Full adder strutturale library IEEE; use ieee.std_logic_1164.all; entity fullAdder is port (a,b,c : in std_logic; s, cout: out std_logic); end entity fullAdder; architecture strutturale of fullAdder is component halfAdder port ( a : in STD_LOGIC; b : in STD_LOGIC; s : out STD_LOGIC; cout : out STD_LOGIC); end component ; component orgate port ( a : in STD_LOGIC; b : in STD_LOGIC; y : out STD_LOGIC); end component ;
..........
Full adder strutturale
...... signal s0, c0, c1 : std_logic; begin H1 : halfAdder port map (a,b,s0,c0); H2 : halfAdder port map (a =>s0 ,b =>c , s =>s , cout => c1); O1 : orgate port map (a =>c0 , b=>c1, y =>cout ); end architecture strutturale;
architecture nome_architettura of nome_entita is dichiarazioni di tipo dichiarazioni di segnali dichiarazioni di costanti definizione di funzioni definizioni di procedure dichiarazioni di componenti begin statement concorrente
... nome_label : nome_componente port map (segnale 1 , segnale 2 , ..., segnaleN); nome_label : nome_componente port map (port 1 => segnale 1 , ..., portN => segnaleN);
Full adder strutturale
...... signal s0, c0, c1 : std_logic; begin H1 : halfAdder port map (a,b,s0,c0); H2 : halfAdder port map (a =>s0 ,b =>c , s =>s , cout => c1); O1 : orgate port map (a =>c0 , b=>c1, y =>cout ); end architecture strutturale;
21.... 22 begin 23 f 1 : full_add 24 port map (i 2 => a 2 , i 1 => a 1 , i 0 => a 0 , s => s 0 , c => c 0 ); 25 26 h 1 : half_add 27 port map (i 1 => a 3 , i 0 => s 0 , s => y 0 , c => x 0 ); 28 29 h 2 : half_add 30 port map (c 0 , x 0 , y 1 , y 2 ); 31 32 end strutturale; a a a a s c x y2 y1 y
library ieee; use ieee.std_logic_ 1164. all ; entity inv 16 is port (a : in std_logic_vector ( 15 downto 0 ); b : out std_logic_vector ( 15 downto 0 )); end ; architecture structure of inv 16 is component INV port (I : in std_logic; O : out std_logic); end component ; begin g 1 : for k in 15 downto 0 generate n 1 : INV port map (I => a(k), O => b(k)); end generate ; end structure;
library ieee; use ieee.std_logic_1164. all ; entity invx is generic (size : integer); port (a : in std_logic_vector (size- 1 downto 0); b : out std_logic_vector (size- 1 downto 0)); end ; architecture structure of invx is component INV port (I : in std_logic; O : out std_logic); end component ; begin g1 : for k in size- 1 downto 0 generate n1 : INV port map (I => a(k), O => b(k)); end generate ; end structure;