1 -------------------------------------------------------------------------------
2 --! @file debug_key_detect.vhd
3 --! @author Marc Kossmann
4 --! @author Michael Riedel
8 --! @brief Debug component
9 --! @details Evaluates switches and keys and sets registers accordingly.
11 --! @details v0.1.0 25.11.2014 Riedel & Kossmann
13 --! @details v0.1.1 02.12.2014 Kossmann
14 --! - complete redesign because registers in register_interface
15 --! should be written only when input changes
16 --! @details v0.1.2 05.12.2014 Riedel
17 --! - added few comments to code for better findability
18 --! - corrected formatting and indention
19 --! @details v1.0.0 05.12.2014 Riedel & Kossmann
20 --! - release milestone 3b
21 -------------------------------------------------------------------------------
23 --! Use Standard Library
25 --! Use Logic Elements
26 USE ieee.std_logic_1164.
all;
28 --! @brief Debug-Component
31 clock : IN ;
--! component clock
33 switches : IN (9 DOWNTO 0);
--! Switches to set registers in register_interface
34 key : IN ;
--! Run/Stop key0
35 read_data : IN (31 DOWNTO 0);
--! data of selected register
36 ce_n : OUT ;
--! chip enable
37 write_n : OUT ;
--! write enable for register_interface
38 read_n : OUT ;
--! read enable for register_interface
39 addr : OUT (2 DOWNTO 0);
--! selects the register to write
40 write_data : OUT (31 DOWNTO 0) --! data to write to selected register
44 --! @brief Architecture of debug_key_detect
45 --! @details realized functionality:
46 --! - evaluting switches
50 --! @brief Tutorial-Component Key-Detector
54 clock :
IN ;
--! Component Clock
55 reset_n :
IN ;
--! Component Reset
61 SIGNAL key0_detect_wire : ;
--! Signal to detect key0 press
62 SIGNAL key0_reg : ;
--! Signal to toggle run/stop in ctrlReg(0) via key0
63 SIGNAL old_switches : (9 DOWNTO 0);
64 SIGNAL reg_write_stage : ;
85 write_data <= (others => '0');
-- unused bits to 0
87 ELSIF(rising_edge(clock)) then
89 IF(key0_detect_wire = '1') then
90 -- user toggled run/stop key
91 run_bit <= not run_bit;
94 write_data <= (others => '0');
-- unused bits to 0
96 -- user changed the speed via switches
99 write_data <= (others => '0');
-- unused bits to 0
100 ELSIF(reg_write_stage = 0) then
101 -- read the switches-positions ...
110 reg_write_stage <=
1;
112 ELSIF(reg_write_stage = 1) then
113 -- ... write them to the register ...
116 reg_write_stage <=
2;
117 ELSIF(reg_write_stage = 2) then
118 -- ... reset the addr and disable the write-signal
128 END my_debug_key_detect;
in switchesSTD_LOGIC_VECTOR(9 DOWNTO0)
Switches to set registers in register_interface.
in reset_nSTD_LOGIC
Component Reset.
in keySTD_LOGIC
Run/Stop key0.
out addrSTD_LOGIC_VECTOR(2 DOWNTO0)
selects the register to write
out write_nSTD_LOGIC
write enable for register_interface
out write_dataSTD_LOGIC_VECTOR(31 DOWNTO0)
data to write to selected register
in key_inputSTD_LOGIC
Siggnal vom Taster.
in read_dataSTD_LOGIC_VECTOR(31 DOWNTO0)
data of selected register
out read_nSTD_LOGIC
read enable for register_interface
Tutorial-Component Key-Detector.
in clockSTD_LOGIC
component clock
out ce_nSTD_LOGIC
chip enable
in reset_nSTD_LOGIC
reset of component
in clockSTD_LOGIC
Component Clock.
_library_ ieeeieee
Use Standard Library.
out key_detectSTD_LOGIC
Detect-Signal for key.