1 -- `Deep Thought', a softcore CPU implemented on a FPGA
3 -- Copyright (C) 2010 Markus Hofstaetter <markus.manrow@gmx.at>
4 -- Copyright (C) 2010 Martin Perner <e0725782@student.tuwien.ac.at>
5 -- Copyright (C) 2010 Stefan Rebernig <stefan.rebernig@gmail.com>
6 -- Copyright (C) 2010 Manfred Schwarz <e0725898@student.tuwien.ac.at>
7 -- Copyright (C) 2010 Bernhard Urban <lewurm@gmail.com>
9 -- This program is free software: you can redistribute it and/or modify
10 -- it under the terms of the GNU General Public License as published by
11 -- the Free Software Foundation, either version 3 of the License, or
12 -- (at your option) any later version.
14 -- This program is distributed in the hope that it will be useful,
15 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
16 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 -- GNU General Public License for more details.
19 -- You should have received a copy of the GNU General Public License
20 -- along with this program. If not, see <http://www.gnu.org/licenses/>.
23 use IEEE.std_logic_1164.all;
24 use IEEE.numeric_std.all;
26 --use work.math_pkg.all;
27 use work.common_pkg.all;
28 use work.core_pkg.all;
31 use work.extension_pkg.all;
32 use work.extension_7seg_pkg.all;
34 architecture behav of extension_7seg is
36 signal s_state, s_state_nxt : sseg_state_rec;
37 signal ext_reg_r : extmod_rec;
41 seg_syn: process(sys_clk, sys_res_n)
45 if (sys_res_n = RESET_VALUE) then
47 s_state.digit0 <= (others => '0');--set(0,7);
48 s_state.digit1 <= (others => '0');--set(0,7);
49 s_state.digit2 <= (others => '0');--set(0,7);
50 s_state.digit3 <= (others => '0');--set(0,7);
53 ext_reg_r.wr_en <= '0';
54 ext_reg_r.byte_en <= (others => '0');
55 ext_reg_r.data <= (others => '0');
56 ext_reg_r.addr <= (others => '0');
58 elsif rising_edge(sys_clk) then
60 s_state <= s_state_nxt;
67 seg_asyn: process(s_state, ext_reg_r)
70 s_state_nxt <= s_state;
72 if ext_reg_r.sel = '1' and ext_reg_r.wr_en = '1' then
75 -- case ext_reg_r.byte_en(1 downto 0) is
77 -- s_state_nxt.digit0 <= digit_decode('0' & ext_reg_r.data(3 downto 0));
78 -- s_state_nxt.digit1 <= digit_decode('0' & ext_reg_r.data(7 downto 4));
79 -- s_state_nxt.digit2 <= digit_decode('0' & ext_reg_r.data(11 downto 8));
80 -- s_state_nxt.digit3 <= digit_decode('0' & ext_reg_r.data(15 downto 12));
82 -- s_state_nxt.digit0 <= (others => '1');
83 -- s_state_nxt.digit1 <= (others => '1');
84 -- s_state_nxt.digit2 <= (others => '1');
85 -- s_state_nxt.digit3 <= (others => '1');
88 if (ext_reg_r.byte_en(0) = '1') then
89 s_state_nxt.digit0 <= digit_decode('0' & ext_reg_r.data(3 downto 0));
90 s_state_nxt.digit1 <= digit_decode('0' & ext_reg_r.data(7 downto 4));
92 if (ext_reg_r.byte_en(1) = '1') then
93 s_state_nxt.digit2 <= digit_decode('0' & ext_reg_r.data(11 downto 8));
94 s_state_nxt.digit3 <= digit_decode('0' & ext_reg_r.data(15 downto 12));
99 end process; --ps2_next
101 seg_out: process(s_state)
104 o_digit0 <= not(s_state.digit0);
105 o_digit1 <= not(s_state.digit1);
106 o_digit2 <= not(s_state.digit2);
107 o_digit3 <= not(s_state.digit3);