Altera_Forum
Honored Contributor
16 years agoPart V-Lab Exercise 1
So after reading Part V like a few times,i fairly understand what does this examples wants me to do,and from the VHDL code given,i manage to get HEX0 going.
One problem is the statement of "you will need to use three instances of each of the subcircuits".What does this mean?Do i create 3 different VHDL codes and compiled to 1 like c++? or do i do everything in one page? I am pretty confused with the code in bold given in the script.Could anyone explain to me what does it really mean? ------------------------------------------------------------------------ LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY chiong4 IS PORT (S,U,V,W : IN STD_LOGIC_VECTOR(1 DOWNTO 0); HEX0 : OUT STD_LOGIC_VECTOR(0 TO 6); HEX1 : OUT STD_LOGIC_VECTOR(0 TO 6); HEX2 : OUT STD_LOGIC_VECTOR(0 TO 6); LEDR : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); END chiong4; ARCHITECTURE Behavior OF chiong4 IS COMPONENT mux_2bit_3to1 PORT ( S, U, V, W : IN STD_LOGIC_VECTOR(1 DOWNTO 0); M : OUT STD_LOGIC_VECTOR(1 DOWNTO 0)); END COMPONENT; ------------------------------------------------------------------------------------------------- COMPONENT char_7seg PORT ( C : IN STD_LOGIC_VECTOR(1 DOWNTO 0); Display : OUT STD_LOGIC_VECTOR(0 TO 6)); END COMPONENT; COMPONENT char_7seg1 PORT ( D : IN STD_LOGIC_VECTOR(1 DOWNTO 0); Display1 : OUT STD_LOGIC_VECTOR(0 TO 6)); END COMPONENT; COMPONENT char_7seg2 PORT ( E : IN STD_LOGIC_VECTOR(1 DOWNTO 0); Display2 : OUT STD_LOGIC_VECTOR(0 TO 6)); END COMPONENT; -------------------------------------------------------------------------------------------------- SIGNAL M : STD_LOGIC_VECTOR(1 DOWNTO 0); BEGIN LEDR<=S & W & V & U; m0: mux_2bit_3to1port map (s(1 downto 0),u(1 downto 0),v(1 downto 0),w(1 downto 0), m);
h0: char_7seg
port map (m, hex0);
h1: char_7seg1
port map (m, hex1);
h2: char_7seg2
port map (m, hex2); END Behavior; --------------------------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY mux_2bit_3to1 IS PORT ( S, U, V, W : IN STD_LOGIC_VECTOR(1 DOWNTO 0); M : OUT STD_LOGIC_VECTOR(1 DOWNTO 0)); END mux_2bit_3to1; ARCHITECTURE Behavior OF mux_2bit_3to1 IS begin M <= u when (s(0) ='0' and s(1) ='0') else v when (s(0) ='1' and s(1) ='0') else w when (s(0) ='0' and s(1) ='1') else w; END Behavior; --------------------------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY char_7seg IS PORT ( C : IN STD_LOGIC_VECTOR(1 DOWNTO 0); Display : OUT STD_LOGIC_VECTOR(0 TO 6)); END char_7seg; ARCHITECTURE Behavior OF char_7seg IS begin DISPLAY <="1000010" WHEN C = "00" ELSE "0110000" WHEN C = "01" ELSE "1001111" WHEN C = "10" ELSE "1111111"; END Behavior; LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY char_7seg1 IS PORT ( D : IN STD_LOGIC_VECTOR(1 DOWNTO 0); Display1 : OUT STD_LOGIC_VECTOR(0 TO 6)); END char_7seg1; ARCHITECTURE Behavior OF char_7seg1 IS begin DISPLAY1 <="1000010" WHEN D = "00" ELSE "0110000" WHEN D = "01" ELSE "1001111" WHEN D = "10" ELSE "1111111"; END Behavior; LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY char_7seg2 IS PORT ( E : IN STD_LOGIC_VECTOR(1 DOWNTO 0); Display2 : OUT STD_LOGIC_VECTOR(0 TO 6)); END char_7seg2; ARCHITECTURE Behavior OF char_7seg2 IS begin DISPLAY2 <="1000010" WHEN E = "00" ELSE "0110000" WHEN E = "01" ELSE "1001111" WHEN E = "10" ELSE "1111111"; END Behavior;