hotovy priklad 5 funguje uplne bez problemov

This commit is contained in:
filipriec skolsky PC
2026-03-09 17:03:42 +01:00
parent db3b8977bf
commit a87a3896cc
6 changed files with 343 additions and 10 deletions

View File

@@ -69,7 +69,21 @@ architecture Behavioral of top_modul is
component decoder_an is
Port ( SEL : in STD_LOGIC_VECTOR (1 downto 0);
ANODES : out STD_LOGIC_VECTOR (1 downto 0));
ANODES : out STD_LOGIC_VECTOR (3 downto 0));
end component;
component mux is
Port ( I0 : in STD_LOGIC_VECTOR (3 downto 0);
I1 : in STD_LOGIC_VECTOR (3 downto 0);
I2 : in STD_LOGIC_VECTOR (3 downto 0);
I3 : in STD_LOGIC_VECTOR (3 downto 0);
S : in STD_LOGIC_VECTOR (1 downto 0);
Y : out STD_LOGIC_VECTOR (3 downto 0));
end component;
component dec_seg is
Port ( bcd : in STD_LOGIC_VECTOR (3 downto 0);
seg : out STD_LOGIC_VECTOR (7 downto 0));
end component;
signal clk_1_Hz : std_logic;
@@ -80,6 +94,10 @@ architecture Behavioral of top_modul is
signal s_cnt_tens : std_logic_vector(3 downto 0); -- To MUX I1
signal s_cnt_2bit : std_logic_vector(1 downto 0);
signal s_mux_out : std_logic_vector(3 downto 0);
signal s_ce_units : std_logic;
begin
@@ -98,12 +116,13 @@ begin
CLK_400_Hz => clk_400_Hz
);
s_ce_units <= clk_1_Hz and START;
-- TOP COUNTER (Units)
U_CNT_TOP : counter
port map (
CLK => CLK,
RST => RST,
CE => START,
CE => s_ce_units,
TC => s_tc_units,
COUNT_OUT => s_cnt_units
);
@@ -130,6 +149,21 @@ begin
SEL => s_cnt_2bit, -- 2-bitov<6F> sign<67>l
ANODES => ANODS -- V<>stupn<70> port top modulu
);
U_MUX : mux
port map (
I0 => s_cnt_units, -- V<>stup z prv<72>ho <20><>ta<74>a
I1 => s_cnt_tens, -- V<>stup z druh<75>ho <20><>ta<74>a
I2 => "0000", -- Zatia<69> nevyu<79>it<69> (nula)
I3 => "0000", -- Zatia<69> nevyu<79>it<69> (nula)
S => s_cnt_2bit, -- Sign<67>l zo zelen<65>ho <20><>ta<74>a (v<>ber an<61>dy)
Y => s_mux_out -- Vybran<61> <20><>slica pre segmenty
);
U_DEC_SEG : dec_seg
port map (
BCD => s_mux_out, -- <20><>slica vybran<61> multiplexerom
SEG => SEGMENTS -- V<>stupn<70> port top modulu (8 bitov)
);
end Behavioral;