-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsec_splitter.vhd
More file actions
65 lines (58 loc) · 1.45 KB
/
Copy pathsec_splitter.vhd
File metadata and controls
65 lines (58 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
--Divide el numero de segundos de 0 a 59 en las
--decenas y unidades del numero
entity sec_splitter is
port(
sec : in std_logic_vector (5 downto 0); --Numero de 0 a 59 input
dec: out std_logic_vector (3 downto 0); --Decenaas output
uni: out std_logic_vector (3 downto 0) --Unidades output
);
end sec_splitter;
architecture behavior of sec_splitter is
signal resta : std_logic_vector(5 downto 0) := "000000";
begin
process(sec, resta)
begin
--Si excede los 59
if (sec > "111011") then
dec <= "0101";
uni <= "1001";
-- 49 < x < 60
elsif (sec > "110001") then
dec <= "0101";
resta <= sec - "110010";
uni <= resta(3 downto 0);
-- 39 < x < 49
elsif (sec > "100111") then
dec <= "0100";
resta <= sec - "101000";
uni <= resta(3 downto 0);
-- 29 < x < 39
elsif (sec > "011101") then
dec <= "0011";
resta <= sec - "011110";
uni <= resta(3 downto 0);
-- 19 < x < 29
elsif (sec > "010011") then
dec <= "0010";
resta <= sec - "010100";
uni <= resta(3 downto 0);
-- 9 < x < 19
elsif (sec > "001001") then
dec <= "0001";
resta <= sec - "001010";
uni <= resta(3 downto 0);
-- 1 < x < 9
elsif (sec > "000000") then
dec <= "0000";
resta <= sec;
uni <= resta(3 downto 0);
--0
else
dec <= "0000";
uni <= "0000";
end if;
end process;
end behavior;