eternalXL
Newbie level 5
- Joined
- Aug 28, 2014
- Messages
- 8
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 80
Hi
I'm a student doing a project now and I run into some problems about testing two inout signals.
I'm inserting a PS/2 mouse module with Wishbone, but before so I need to test if the signals can really be transferred.
Here is my codes: PS/2 mouse is written in Verilog and I mixed Verilog and VHDL first.
And the principle of the two inout signal ps2d and ps2d is
1. The host forces the ps2c line to be 0 for at least 100 ps to inhibit any mouse activity.
It can be considered that the host requests to send a packet.
2. The host forces the ps2d line to be 0 and disables the ps2c line (i.e., makes it high
impedance). This step can be interpreted as the host sending a start bit.
3. The PS2 device now takes over the ps2c line and is responsible for future PS2 clock
signal generation. After sensing the starting bit, the PS2 device generates a 1-to-0
transition.
4. Once detecting the transition, the host shifts out the least significant data bit over the
ps2d line. It holds this value until the PS2 device generates a 1-to-0 transition in the
ps2c line, which essentially acknowledges retrieval of the data bit.
5. Repeat step 4 for the remaining 7 data bits and 1 parity bit.
6. After sending the parity bit, the host disables the ps2d line (i.e., makes it high impedance).
The PS2 device now takes over the ps2d line and acknowledges completion
of the transmission by asserting the ps2d line to 0. If desired, the host can check this
value at the last 1-to-0 transition in the ps2c line to verify that the packet has been
transmitted successfully.
So for the test bench, I was wondering if I can only be either the device or the host, how can I put value on the inout signals to test...
Thanks a lot for your reading and help.
I'm a student doing a project now and I run into some problems about testing two inout signals.
I'm inserting a PS/2 mouse module with Wishbone, but before so I need to test if the signals can really be transferred.
Here is my codes: PS/2 mouse is written in Verilog and I mixed Verilog and VHDL first.
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; library UNISIM; use UNISIM.VComponents.all; entity zpuino_mouse_test is port( wb_clk_i: in std_logic; wb_rst_i: in std_logic; wb_dat_o: out std_logic_vector(15 downto 0); wb_adr_i: in std_logic_vector(3 downto 0); wb_cyc_i: in std_logic; wb_stb_i: in std_logic; wb_ack_o: out std_logic; wb_inta_o:out std_logic; --zpuino_mouse interface ps2dz: inout std_logic; ps2cz: inout std_logic ); end zpuino_mouse_test; architecture Behavioral of zpuino_mouse_test is component mouse is port( clk: in std_logic; reset: in std_logic; ps2d: inout std_logic; ps2c: inout std_logic; xm: out std_logic_vector(8 downto 0); ym: out std_logic_vector(8 downto 0); btnm: out std_logic_vector(2 downto 0); m_done_tick: out std_logic ); end component mouse; signal xmz: std_logic_vector(8 downto 0); signal ymz: std_logic_vector(8 downto 0); signal btnmz: std_logic_vector(2 downto 0); signal m_done_tickz: std_logic ; begin m1 : mouse port map( clk => wb_clk_i, reset => wb_rst_i, ps2d => ps2dz, ps2c => ps2cz, xm => xmz, ym => ymz, btnm => btnmz, m_done_tick => m_done_tickz); wb_ack_o <= wb_cyc_i and wb_stb_i; wb_inta_o <= '0'; process (wb_clk_i,wb_rst_i,wb_adr_i) begin if wb_rst_i = '1' then wb_dat_o <= (others => 'X'); elsif (wb_clk_i'event and wb_clk_i='1') then case wb_adr_i(2) is when '0' => wb_dat_o(8 downto 0) <= xmz; wb_dat_o(11 downto 9) <= btnmz; wb_dat_o(12) <=m_done_tickz; when '1' => wb_dat_o(8 downto 0) <= ymz; wb_dat_o(11 downto 9) <= btnmz; wb_dat_o(12) <=m_done_tickz; when others => wb_dat_o <= (others => 'X'); end case; end if; end process; end Behavioral;
And the principle of the two inout signal ps2d and ps2d is
1. The host forces the ps2c line to be 0 for at least 100 ps to inhibit any mouse activity.
It can be considered that the host requests to send a packet.
2. The host forces the ps2d line to be 0 and disables the ps2c line (i.e., makes it high
impedance). This step can be interpreted as the host sending a start bit.
3. The PS2 device now takes over the ps2c line and is responsible for future PS2 clock
signal generation. After sensing the starting bit, the PS2 device generates a 1-to-0
transition.
4. Once detecting the transition, the host shifts out the least significant data bit over the
ps2d line. It holds this value until the PS2 device generates a 1-to-0 transition in the
ps2c line, which essentially acknowledges retrieval of the data bit.
5. Repeat step 4 for the remaining 7 data bits and 1 parity bit.
6. After sending the parity bit, the host disables the ps2d line (i.e., makes it high impedance).
The PS2 device now takes over the ps2d line and acknowledges completion
of the transmission by asserting the ps2d line to 0. If desired, the host can check this
value at the last 1-to-0 transition in the ps2c line to verify that the packet has been
transmitted successfully.
So for the test bench, I was wondering if I can only be either the device or the host, how can I put value on the inout signals to test...
Thanks a lot for your reading and help.
Last edited by a moderator: