-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemote_Robot_Sim.ghdp
More file actions
155 lines (140 loc) · 4.89 KB
/
Copy pathRemote_Robot_Sim.ghdp
File metadata and controls
155 lines (140 loc) · 4.89 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
Component Remote_Robot_tb()
{
--UART l.144 -> 1200000 -> 12000 for simulation
SIGNAL finished : STD_LOGIC:= '0';
CONSTANT period_time : TIME := 83333 ps;
Process Sim_finished()
{
wait for 100000 us;
finished <= '1';
wait;
}
NewComponent WiFi_Robot_Demo
(
Encoder_L => Encoder_L,
Encoder_R => Encoder_R,
Motor_LF => Motor_LF,
Motor_LB => Motor_LB,
Motor_RF => Motor_RF,
Motor_RB => Motor_RB,
BTN => BTN,
LED => LED,
RX => RX,
TX => TX,
WiFi_TX => WiFi_TX,
WiFi_RX => WiFi_RX,
CLK => CLK,
);
SIGNAL Encoder_L : STD_LOGIC ;
SIGNAL Encoder_R : STD_LOGIC ;
SIGNAL Motor_LF : STD_LOGIC ;
SIGNAL Motor_LB : STD_LOGIC ;
SIGNAL Motor_RF : STD_LOGIC ;
SIGNAL Motor_RB : STD_LOGIC ;
SIGNAL BTN : STD_LOGIC ;
SIGNAL LED : STD_LOGIC ;
SIGNAL RX : STD_LOGIC := '1';
SIGNAL TX : STD_LOGIC ;
SIGNAL WiFi_TX : STD_LOGIC ;
SIGNAL WiFi_RX : STD_LOGIC ;
SIGNAL CLK : STD_LOGIC := '0';
Process Sim_BTN()
{
While(finished /= '1')
{
BTN <= '0';
wait for period_time;
BTN <= '1';
wait for period_time*2;
BTN <= '0';
wait for period_time;
wait;
}
wait;
}
Process Sim_Encoder_L()
{
While(finished /= '1')
{
Encoder_L <= '0';
wait for 50 us;
Encoder_L <= '1';
wait for 50 us;
}
wait;
}
Process Sim_Encoder_R()
{
While(finished /= '1')
{
Encoder_R <= '0';
wait for 50 us;
Encoder_R <= '1';
wait for 50 us;
}
wait;
}
Process Sim_WiFi_TX()
{
While(finished /= '1')
{
wait for period_time;
Thread
{
Wait(1200us);
NewFunction write (s"l", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
NewFunction write (s"5", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
Wait(1200us);
NewFunction write (s"n", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
NewFunction write (s"1", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
Wait(1200us);
NewFunction write (s"m", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
NewFunction write (s"0", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
Wait(10ms);
NewFunction write (s"m", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
NewFunction write (s"1", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
Wait(10ms);
NewFunction write (s"m", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
NewFunction write (s"4", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
Wait(1200us);
NewFunction write (s"r", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
NewFunction write (s"1", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
Wait(10ms);
NewFunction write (s"b", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
NewFunction write (s"1", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
Wait(10ms);
NewFunction write (s"r", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
NewFunction write (s"1", UART_Interface_TX_Data, UART_Interface_TX_Busy, UART_Interface_TX_Enable);
Wait(10ms);
}
}
wait;
}
Process Sim_CLK()
{
While(finished /= '1')
{
CLK <= '0';
wait for period_time/2;
CLK <= '1';
wait for period_time/2;
}
wait;
}
SIGNAL UART_Interface_TX_Enable : STD_LOGIC := '0';
SIGNAL UART_Interface_TX_Busy : STD_LOGIC := '0';
SIGNAL UART_Interface_TX_Data : STD_LOGIC_VECTOR (8-1 DOWNTO 0) := (others => '0');
NewComponent UART_Interface
(
CLK_Frequency => 12000000,
Baud_Rate => 115200,
OS_Rate => 16,
D_Width => 8,
Parity => 0,
Parity_EO => '0',
TX => WiFi_TX,
TX_Enable =>UART_Interface_TX_Enable,
TX_Busy =>UART_Interface_TX_Busy,
TX_Data =>UART_Interface_TX_Data,
);
}