









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Component Instantiation
architecture rtl of mux is begin process (a,b,c,d,sel) begin case sel is when “00” => q<=a; when “01” => q<=b; when “10” => q<=c; when others => q<=d; end case ; end process ; end ;
-- Configuration for architecture bhv
configuration bhv of mux is for bhv end for ; end bhv;
-- Configuration for architecture rtl configuration rtl of mux is
for rtl end for ;
end rtl;
package mypack is function minimum (a,b: in std_logic_vector) return std_logic_vector; component c1 port (clk,resetn,din: in std_logic; q1,q2: out std_logic); end component ; component c2 port (a,b: in std_logic; q: out std_logic); end component ; end mypack;
package body mypack is function minimum (a,b: in std_logic_vector) return std_logic_vector is begin if a<b then return a; else return b; end if ; end minimum; end mypack;
library ieee; use ieee.std_logic_1164.ALL; use work.mypack.ALL;
entity ex is port (clk,resetn: in std_logic; d1,d2: out std_logic; a,b: in std_logic_vector(3 downto 0); q1,q2,q3: out std_logic; q4: out std_logic_vector(3 downto 0)); end ;
Architecture rtl of ex is begin U1: c1 port map (clk,resetn,d1,q1,q2); U2: c2 port map (d1,d2,q3); q4<=minimum(a,b); end ;