-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFSM_tb.vhd
79 lines (67 loc) · 1.71 KB
/
FSM_tb.vhd
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
library IEEE;
use IEEE.NUMERIC_STD.ALL;
use IEEE.STD_LOGIC_1164.ALL;
entity FSM_tb is
END FSM_tb;
Architecture behav of FSM_tb is
component FSM
Port ( start : in STD_LOGIC;
stop : in STD_LOGIC;
scl : in STD_LOGIC;
sda : in STD_LOGIC;
ack0 : out STD_LOGIC;
ack1 : out STD_LOGIC;
ack2 : out STD_LOGIC;
addr : out STD_LOGIC;
reg : out STD_LOGIC;
rw : out STD_LOGIC;
data : out STD_LOGIC;
enclk : out STD_LOGIC;
number : out UNSIGNED (2 downto 0)
);
END Component;
Component validate
Port(
sdaIn : in std_logic;
sclIn : in std_logic;
sdaOut : out std_logic ;
start : out std_logic;
stop : out std_logic
);
END component;
signal Start : STD_LOGIC;
Signal Stop : STD_LOGIC;
signal Scl : STD_LOGIC;
signal Sda : STD_LOGIC;
signal Ack0 : STD_LOGIC;
signal Ack1 : STD_LOGIC;
signal Ack2 : STD_LOGIC;
signal Addr : STD_LOGIC;
signal Reg : STD_LOGIC;
signal Rw : STD_LOGIC;
signal Data : STD_LOGIC;
signal Enclk : STD_LOGIC;
signal Number : UNSIGNED (2 downto 0);
signal SDA : std_logic := 'H';
begin
f : FSM PORT MAP(
start => Start, stop=>Stop, scl => Scl, sda=> Sda,
ack0=> Ack0, ack1 => Ack1, ack2=> Ack2, addr=> Addr,
reg=> Reg, rw=> Rw, data=>Data, enclk=>Enclk, number=>Number
);
v : validate Port map (
sdaIn => SDA, sclIn => Scl, sdaOut => Sda, start=>Start, stop => Stop );
clck_proc: process begin
wait for 200 ns;
Scl <= not Scl;
END process;
stim_process: begin
wait for 100 ns;
SDA <= '0';
wait for 100 ns;
SDA <= 'H';
wait for 100 ns;
SDA <= '0';
wait for 100 ns;
END process;
END;