aboutsummaryrefslogtreecommitdiff
path: root/computer-organization-experiment/test_bench.vhdl
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-11-09 17:44:15 +0800
committercrupest <crupest@outlook.com>2021-11-09 17:44:15 +0800
commit18d160e7575374a73b4fd22ec5cc98690105aa69 (patch)
tree4c82112f0c4908895901330ea0199976e87ec90a /computer-organization-experiment/test_bench.vhdl
parent4474947842a39dc2497cb0156a76fadd39443d88 (diff)
downloadlife-18d160e7575374a73b4fd22ec5cc98690105aa69.tar.gz
life-18d160e7575374a73b4fd22ec5cc98690105aa69.tar.bz2
life-18d160e7575374a73b4fd22ec5cc98690105aa69.zip
...
Diffstat (limited to 'computer-organization-experiment/test_bench.vhdl')
-rw-r--r--computer-organization-experiment/test_bench.vhdl45
1 files changed, 45 insertions, 0 deletions
diff --git a/computer-organization-experiment/test_bench.vhdl b/computer-organization-experiment/test_bench.vhdl
new file mode 100644
index 0000000..be15df9
--- /dev/null
+++ b/computer-organization-experiment/test_bench.vhdl
@@ -0,0 +1,45 @@
+LIBRARY IEEE;
+USE IEEE.STD_LOGIC_1164.ALL;
+USE IEEE.STD_LOGIC_UNSIGNED.ALL;
+
+entity test_bench is
+end test_bench;
+
+architecture test_counter_4 of test_bench is
+ signal CLK : STD_LOGIC;
+ signal CQ: STD_LOGIC_VECTOR(3 DOWNTO 0);
+begin
+ counter: entity work.counter_4(behavior)
+ port map (CLK, CQ);
+ stimulus: process is
+ begin
+ for count_value in 0 to 2 ** 4 - 1 loop
+ if count_value mod 2 = 0 then
+ CLK <= '1';
+ wait for 5 ns;
+ else
+ CLK <= '0';
+ wait for 5 ns;
+ end if;
+ end loop;
+ end process stimulus;
+end architecture test_counter_4;
+
+
+architecture test_full_adder_1 of test_bench is
+ subtype v3 is std_logic_vector(2 downto 0);
+ signal I: v3 := B"000";
+ signal S, CO : STD_LOGIC;
+begin
+ adder: entity work.full_adder_1(behavior)
+ port map (I(2), I(1), I(0), S, CO);
+ stimulus: process is
+ variable ii : v3 := B"000";
+ begin
+ loop
+ ii := ii + 1;
+ I <= ii;
+ wait for 5 ns;
+ end loop;
+ end process stimulus;
+end architecture test_full_adder_1;