Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
vhdl_workshop:lab_2 [2017/02/10 14:11] SSE Minion created |
vhdl_workshop:lab_2 [2017/02/15 13:20] SSE Minion [Synopsis] |
||
---|---|---|---|
Line 3: | Line 3: | ||
As the module will be used to multiplex single digit values later on, the bus widths need to be adjusted. This is easily done by specifying a range for all data signals which are of type integer. Additionally, | As the module will be used to multiplex single digit values later on, the bus widths need to be adjusted. This is easily done by specifying a range for all data signals which are of type integer. Additionally, | ||
- | TODO Bild The enhanced multiplexer | + | {{: |
==== Behaviour ==== | ==== Behaviour ==== | ||
Line 20: | Line 20: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | TODO Code Modified | + | <code vhdl DISP_MUX.VHD> |
+ | library ieee; | ||
+ | use ieee.std_logic_1164.all; | ||
+ | |||
+ | entity DISP_MUX is | ||
+ | port(EXP_TIME | ||
+ | | ||
+ | | ||
+ | -- add ERROR port | ||
+ | | ||
+ | end DISP_MUX; | ||
+ | |||
+ | architecture RTL of DISP_MUX is | ||
+ | begin | ||
+ | process(NO_PICS, | ||
+ | begin | ||
+ | -- add ERROR condition | ||
+ | if SHOW_TIME = ' | ||
+ | -- output = exposure time | ||
+ | else | ||
+ | -- output = picture count | ||
+ | end if; | ||
+ | end process; | ||
+ | end RTL; | ||
+ | </ | ||
+ | |||
+ | ===== Testbench ===== | ||
+ | <code vhdl TB_DISP_MUX.VHD> | ||
+ | library ieee; | ||
+ | use ieee.std_logic_1164.all; | ||
+ | |||
+ | entity TB_DISP_MUX is | ||
+ | end TB_DISP_MUX; | ||
+ | |||
+ | architecture TEST of TB_DISP_MUX is | ||
+ | component DISP_MUX | ||
+ | port(EXP_TIME | ||
+ | | ||
+ | | ||
+ | -- add ERROR port | ||
+ | | ||
+ | end component; | ||
+ | |||
+ | signal W_EXP_TIME | ||
+ | signal W_NO_PICS | ||
+ | signal W_SHOW_TIME | ||
+ | signal W_ERROR | ||
+ | signal W_DISP_PHOTO : integer range 0 to 10; | ||
+ | |||
+ | begin | ||
+ | DUT : DISP_MUX | ||
+ | port map ( | ||
+ | EXP_TIME | ||
+ | NO_PICS | ||
+ | SHOW_TIME | ||
+ | ERROR => W_ERROR, | ||
+ | DISP_PHOTO => W_DISP_PHOTO); | ||
+ | |||
+ | STIMULI : process | ||
+ | begin | ||
+ | -- DISP_PHOTO = 0 | ||
+ | wait for 30 ns; | ||
+ | |||
+ | W_NO_PICS <= 2; | ||
+ | W_EXP_TIME <= 5; | ||
+ | -- DISP_PHOTO = 2 | ||
+ | wait for 20 ns; | ||
+ | |||
+ | W_NO_PICS <= 10; | ||
+ | -- DISP_PHOTO = 10 | ||
+ | wait for 20 ns; | ||
+ | |||
+ | W_SHOW_TIME <= ' | ||
+ | -- DISP_PHOTO = 5 | ||
+ | wait for 20 ns; | ||
+ | |||
+ | W_EXP_TIME <= 6; | ||
+ | W_NO_PICS <= 4; | ||
+ | -- DISP_PHOTO = 6 | ||
+ | wait for 20 ns; | ||
+ | |||
+ | W_SHOW_TIME <= ' | ||
+ | -- DISP_PHOTO = 4 | ||
+ | wait for 20 ns; | ||
+ | |||
+ | W_ERROR <= ' | ||
+ | -- DISP_PHOTO = 10 | ||
+ | wait for 20 ns; | ||
+ | |||
+ | W_SHOW_TIME <= ' | ||
+ | -- no changes | ||
+ | wait for 20 ns; | ||
+ | |||
+ | W_ERROR <= ' | ||
+ | -- DISP_PHOTO = 6 | ||
+ | wait for 20 ns; | ||
+ | |||
+ | W_SHOW_TIME <= ' | ||
+ | -- DISP_PHOTO = 4 | ||
+ | wait for 20 ns; | ||
+ | wait; | ||
+ | end process STIMULI; | ||
+ | end TEST; | ||
+ | |||
+ | configuration CFG_TB_DISP_MUX of TB_DISP_MUX is | ||
+ | for TEST | ||
+ | end for; | ||
+ | end CFG_TB_DISP_MUX; | ||
+ | </ | ||