-
Notifications
You must be signed in to change notification settings - Fork 0
/
LEDSnake_Sim.ghdp
76 lines (68 loc) · 1.38 KB
/
LEDSnake_Sim.ghdp
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
Component LEDSnake_tb()
{
SIGNAL finished : STD_LOGIC:= '0';
CONSTANT period_time : TIME := 83333 ps;
Process Sim_finished()
{
wait for 10000 us;
finished <= '1';
wait;
}
NewComponent LEDSnake
(
RX => RX,
TX => TX,
CS_O => CS_O,
CLK_O => CLK_O,
DIN_O => DIN_O,
RightButton => RightButton,
LeftButton => LeftButton,
CLK => CLK,
);
SIGNAL RX : STD_LOGIC ;
SIGNAL TX : STD_LOGIC ;
SIGNAL CS_O : STD_LOGIC ;
SIGNAL CLK_O : STD_LOGIC ;
SIGNAL DIN_O : STD_LOGIC ;
SIGNAL RightButton : STD_LOGIC ;
SIGNAL LeftButton : STD_LOGIC ;
SIGNAL CLK : STD_LOGIC := '0';
Process Sim_RX()
{
While(finished /= '1')
{
wait;
}
wait;
}
Process Sim_RightButton()
{
While(finished /= '1')
{
RightButton <= '1';
wait for 1 ms;
}
wait;
}
Process Sim_LeftButton()
{
While(finished /= '1')
{
LeftButton <= '1';
wait for 1 ms;
wait;
}
wait;
}
Process Sim_CLK()
{
While(finished /= '1')
{
CLK <= '0';
wait for period_time/2;
CLK <= '1';
wait for period_time/2;
}
wait;
}
}