semestralka hotovo
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity clock_logic is
|
||||
Port (
|
||||
@@ -36,8 +36,8 @@ architecture Behavioral of clock_logic is
|
||||
COUNT_OUT : out STD_LOGIC_VECTOR (3 downto 0));
|
||||
end component;
|
||||
|
||||
-- Internal signals to connect the counters
|
||||
signal sig_s_units, sig_s_tens : std_logic_vector(3 downto 0);
|
||||
-- Internal signals to connect the counters
|
||||
signal sig_s_units, sig_s_tens : std_logic_vector(3 downto 0);
|
||||
signal sig_m_units, sig_m_tens : std_logic_vector(3 downto 0);
|
||||
signal sig_h_units, sig_h_tens : std_logic_vector(3 downto 0);
|
||||
-- Carry signals (TC)
|
||||
@@ -49,12 +49,20 @@ architecture Behavioral of clock_logic is
|
||||
signal inc_m_tens : std_logic;
|
||||
signal inc_h_units : std_logic;
|
||||
signal inc_h_tens : std_logic;
|
||||
|
||||
signal next_mu, next_mt, next_hu, next_ht : std_logic_vector(3 downto 0);
|
||||
|
||||
begin
|
||||
inc_m_units <= BTN_INC and DIGIT_SEL(0);
|
||||
inc_m_tens <= BTN_INC and DIGIT_SEL(1);
|
||||
inc_h_units <= BTN_INC and DIGIT_SEL(2);
|
||||
inc_h_tens <= BTN_INC and DIGIT_SEL(3);
|
||||
|
||||
-- MAX_LIMIT respektovanie pocas BTN_INC
|
||||
next_mu <= "0000" when sig_m_units = "1001" else std_logic_vector(unsigned(sig_m_units) + 1);
|
||||
next_mt <= "0000" when sig_m_tens = "0101" else std_logic_vector(unsigned(sig_m_tens) + 1);
|
||||
next_hu <= "0000" when sig_h_units = "1001" else std_logic_vector(unsigned(sig_h_units) + 1);
|
||||
next_ht <= "0000" when sig_h_tens = "0010" else std_logic_vector(unsigned(sig_h_tens) + 1);
|
||||
|
||||
-------------------------------------------------------
|
||||
-- SECONDS SECTION
|
||||
@@ -95,7 +103,7 @@ begin
|
||||
RST => RST,
|
||||
CE => tc_st,
|
||||
PE => inc_m_units, -- for M_UNITS (bit 0)
|
||||
DIN => "0001",
|
||||
DIN => next_mu,
|
||||
TC => tc_mu,
|
||||
COUNT_OUT => sig_m_units
|
||||
);
|
||||
@@ -108,7 +116,7 @@ begin
|
||||
RST => RST,
|
||||
CE => tc_mu,
|
||||
PE => inc_m_tens,
|
||||
DIN => "0010",
|
||||
DIN => next_mt,
|
||||
TC => tc_mt,
|
||||
COUNT_OUT => sig_m_tens
|
||||
);
|
||||
@@ -142,7 +150,7 @@ begin
|
||||
RST => hour_reset,
|
||||
CE => tc_mt,
|
||||
PE => inc_h_units,
|
||||
DIN => "0100",
|
||||
DIN => next_hu,
|
||||
TC => tc_hu,
|
||||
COUNT_OUT => sig_h_units
|
||||
);
|
||||
@@ -155,7 +163,7 @@ begin
|
||||
RST => hour_reset,
|
||||
CE => tc_hu,
|
||||
PE => inc_h_tens,
|
||||
DIN => "1000",
|
||||
DIN => next_ht,
|
||||
TC => open,
|
||||
COUNT_OUT => sig_h_tens
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user