Skip to content

Commit ceec628

Browse files
authored
Working OK on MultiSim
1 parent 2100de9 commit ceec628

File tree

4 files changed

+50
-8
lines changed

4 files changed

+50
-8
lines changed

74ALS190-VHDL/src/contador.vhd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ begin process(clock,reset)
1919
temp <= "0000";
2020
elsif(rising_edge(clock)) then
2121
if enable='0' then
22-
if temp="1001" then
22+
if temp="1111" then
2323
temp<="0000";
2424
else
2525
temp <= temp + 1;

74ALS190-VHDL/src/contador.vhd.bak

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
1+
library ieee;
2+
use ieee.std_logic_1164.all;
3+
use ieee.std_logic_arith.all;
4+
use ieee.std_logic_unsigned.all;
5+
6+
7+
entity counter_190 is
8+
port( enable: in std_logic;
9+
clock: in std_logic;
10+
reset: in std_logic;
11+
output: out std_logic_vector(0 to 3));
12+
end counter_190;
13+
14+
architecture Behavioral of counter_190 is
15+
signal temp: std_logic_vector(0 to 3);
16+
begin process(clock,reset)
17+
begin
18+
if reset='1' then
19+
temp <= "0000";
20+
elsif(rising_edge(clock)) then
21+
if enable='0' then
22+
if temp="1001" then
23+
temp<="0000";
24+
else
25+
temp <= temp + 1;
26+
end if;
27+
end if;
28+
end if;
29+
end process;
30+
output <= temp;
31+
end Behavioral;

74ALS190-VHDL/src/tb_contador.vhd

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,20 @@ counter1: counter_190 port map ( enable => enable_1, clock => clk_1, reset => re
3434

3535
estimulo : process
3636
begin
37-
wait for 5 ns; reset_1 <= '0'; enable_1 <= '0';
37+
reset_1 <= '1'; enable_1 <= '1';
38+
wait for 5 ns;
39+
enable_1 <= '0'; reset_1 <= '0';
40+
wait for 80 ns;
3841
end process estimulo;
3942

4043
clock_estimulo : process
4144

4245
begin
43-
wait for 1 ns; clk_1 <= '0';
44-
wait for 1 ns; clk_1 <= '1';
46+
clk_1 <= '0';
47+
wait for 1 ns;
48+
clk_1 <= '1';
49+
wait for 1 ns;
50+
4551
end process clock_estimulo;
4652

4753
end counter;

74ALS190-VHDL/src/tb_contador.vhd.bak

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,20 @@ counter1: counter_190 port map ( enable => enable_1, clock => clk_1, reset => re
3434

3535
estimulo : process
3636
begin
37-
wait for 5 ns; reset_1 <= '0'; enable_1 <= '1';
37+
reset_1 <= '1'; enable_1 <= '1';
38+
wait for 5 ns;
39+
enable_1 <= '0'; reset_1 <= '0';
40+
wait for 40 ns;
3841
end process estimulo;
3942

4043
clock_estimulo : process
4144

4245
begin
43-
wait for 1 ns; clk_1 <= '0';
44-
wait for 1 ns; clk_1 <= '1';
46+
clk_1 <= '0';
47+
wait for 1 ns;
48+
clk_1 <= '1';
49+
wait for 1 ns;
50+
4551
end process clock_estimulo;
4652

4753
end counter;

0 commit comments

Comments
 (0)