aboutsummaryrefslogtreecommitdiff
path: root/src/top_count.vhd
diff options
context:
space:
mode:
authorFriedrich Beckmann <friedrich.beckmann@tha.de>2024-05-10 12:28:38 +0200
committerFriedrich Beckmann <friedrich.beckmann@tha.de>2024-05-10 12:28:38 +0200
commitbc7d43b160864d53e7e4bbea81b29d5e8903baf4 (patch)
treefbe7a598af34ddbc585976dfe39af253b1dfd864 /src/top_count.vhd
parentee8d484d8531e425a06f23519fc09bbf2e1acf4e (diff)
add top_count
Diffstat (limited to 'src/top_count.vhd')
-rw-r--r--src/top_count.vhd43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/top_count.vhd b/src/top_count.vhd
new file mode 100644
index 0000000..57c6998
--- /dev/null
+++ b/src/top_count.vhd
@@ -0,0 +1,43 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity top_count is
+port ( SW : in std_ulogic_vector(9 downto 0);
+ KEY : in std_ulogic_vector(3 downto 0);
+ CLOCK_50 : in std_ulogic;
+ HEX0 : out std_ulogic_vector(6 downto 0);
+ EXP : out std_ulogic_vector(7 downto 0);
+ LEDG : out std_ulogic_vector(3 downto 0);
+ LEDR : out std_ulogic_vector(9 downto 0));
+end entity;
+
+architecture rtl of top_count is
+ signal clk : std_ulogic;
+ signal rst_n : std_ulogic;
+ signal x : std_ulogic;
+ signal en : std_ulogic;
+ signal cnt : std_ulogic_vector(3 downto 0);
+begin
+ -- Assign the inputs to signals with reasonable names
+ clk <= CLOCK_50;
+ rst_n <= KEY(0);
+ x <= KEY(1);
+
+ cnt <= "0000";
+
+ bin2seg_inst: entity work.bin2seg
+ port map(
+ bin_i => cnt,
+ seg_o => HEX0
+ );
+
+ -- Set the outputs;
+ EXP(7 downto 4) <= cnt;
+ EXP(3 downto 0) <= (3 => en,
+ 2 => x,
+ 1 => rst_n,
+ 0 => clk);
+ LEDR <= SW;
+ LEDG <= KEY;
+
+end architecture rtl; \ No newline at end of file