1 |
2 |
dimamali |
----------------------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- VHDL file generated by X-HDL - Revision 3.2.53 Aug. 1, 2005
|
4 |
|
|
-- Tue Aug 9 07:33:51 2005
|
5 |
|
|
--
|
6 |
|
|
-- Input file : C:/Documents and Settings/BryantI/My Documents/tmp/can_top.v
|
7 |
|
|
-- Design name : can_btl_core_sync
|
8 |
|
|
-- Author :
|
9 |
|
|
-- Company : Actel
|
10 |
|
|
--
|
11 |
|
|
-- Description :
|
12 |
|
|
--
|
13 |
|
|
--
|
14 |
|
|
----------------------------------------------------------------------------------------------
|
15 |
|
|
--
|
16 |
|
|
--////////////////////////////////////////////////////////////////////
|
17 |
|
|
--// ////
|
18 |
|
|
--// can_btl_core_sync.v ////
|
19 |
|
|
--// ////
|
20 |
|
|
--// ////
|
21 |
|
|
--// This file is part of the CAN Protocol Controller ////
|
22 |
|
|
--// http://www.opencores.org/projects/can/ ////
|
23 |
|
|
--// ////
|
24 |
|
|
--// ////
|
25 |
|
|
--// Author(s): ////
|
26 |
|
|
--// Igor Mohor ////
|
27 |
|
|
--// igorm@opencores.org ////
|
28 |
|
|
--// ////
|
29 |
|
|
--// ////
|
30 |
|
|
--// All additional information is available in the README.txt ////
|
31 |
|
|
--// file. ////
|
32 |
|
|
--// ////
|
33 |
|
|
--////////////////////////////////////////////////////////////////////
|
34 |
|
|
--// ////
|
35 |
|
|
--// Copyright (C) 2002, 2003, 2004 Authors ////
|
36 |
|
|
--// ////
|
37 |
|
|
--// This source file may be used and distributed without ////
|
38 |
|
|
--// restriction provided that this copyright statement is not ////
|
39 |
|
|
--// removed from the file and that any derivative work contains ////
|
40 |
|
|
--// the original copyright notice and the associated disclaimer. ////
|
41 |
|
|
--// ////
|
42 |
|
|
--// This source file is free software; you can redistribute it ////
|
43 |
|
|
--// and/or modify it under the terms of the GNU Lesser General ////
|
44 |
|
|
--// Public License as published by the Free Software Foundation; ////
|
45 |
|
|
--// either version 2.1 of the License, or (at your option) any ////
|
46 |
|
|
--// later version. ////
|
47 |
|
|
--// ////
|
48 |
|
|
--// This source is distributed in the hope that it will be ////
|
49 |
|
|
--// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
50 |
|
|
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
51 |
|
|
--// PURPOSE. See the GNU Lesser General Public License for more ////
|
52 |
|
|
--// details. ////
|
53 |
|
|
--// ////
|
54 |
|
|
--// You should have received a copy of the GNU Lesser General ////
|
55 |
|
|
--// Public License along with this source; if not, download it ////
|
56 |
|
|
--// from http://www.opencores.org/lgpl.shtml ////
|
57 |
|
|
--// ////
|
58 |
|
|
--// The CAN protocol is developed by Robert Bosch GmbH and ////
|
59 |
|
|
--// protected by patents. Anybody who wants to implement this ////
|
60 |
|
|
--// CAN IP core on silicon has to obtain a CAN protocol license ////
|
61 |
|
|
--// from Bosch. ////
|
62 |
|
|
--// ////
|
63 |
|
|
--////////////////////////////////////////////////////////////////////
|
64 |
|
|
--
|
65 |
|
|
-- CVS Revision History
|
66 |
|
|
--
|
67 |
|
|
-- $Log: can_btl_core_sync.v,v $
|
68 |
|
|
-- Revision 1.30 2004/10/27 18:51:37 igorm
|
69 |
|
|
-- Fixed synchronization problem in real hardware when 0xf is used for TSEG1.
|
70 |
|
|
--
|
71 |
|
|
-- Revision 1.29 2004/05/12 15:58:41 igorm
|
72 |
|
|
-- Core improved to pass all tests with the Bosch VHDL Reference system.
|
73 |
|
|
--
|
74 |
|
|
-- Revision 1.28 2004/02/08 14:25:26 mohor
|
75 |
|
|
-- Header changed.
|
76 |
|
|
--
|
77 |
|
|
-- Revision 1.27 2003/09/30 00:55:13 mohor
|
78 |
|
|
-- Error counters fixed to be compatible with Bosch VHDL reference model.
|
79 |
|
|
-- Small synchronization changes.
|
80 |
|
|
--
|
81 |
|
|
-- Revision 1.26 2003/09/25 18:55:49 mohor
|
82 |
|
|
-- Synchronization changed, error counters fixed.
|
83 |
|
|
--
|
84 |
|
|
-- Revision 1.25 2003/07/16 13:40:35 mohor
|
85 |
|
|
-- Fixed according to the linter.
|
86 |
|
|
--
|
87 |
|
|
-- Revision 1.24 2003/07/10 15:32:28 mohor
|
88 |
|
|
-- Unused signal removed.
|
89 |
|
|
--
|
90 |
|
|
-- Revision 1.23 2003/07/10 01:59:04 tadejm
|
91 |
|
|
-- Synchronization fixed. In some strange cases it didn't work according to
|
92 |
|
|
-- the VHDL reference model.
|
93 |
|
|
--
|
94 |
|
|
-- Revision 1.22 2003/07/07 11:21:37 mohor
|
95 |
|
|
-- Little fixes (to fix warnings).
|
96 |
|
|
--
|
97 |
|
|
-- Revision 1.21 2003/07/03 09:32:20 mohor
|
98 |
|
|
-- Synchronization changed.
|
99 |
|
|
--
|
100 |
|
|
-- Revision 1.20 2003/06/20 14:51:11 mohor
|
101 |
|
|
-- Previous change removed. When resynchronization occurs we go to seg1
|
102 |
|
|
-- stage. sync stage does not cause another start of seg1 stage.
|
103 |
|
|
--
|
104 |
|
|
-- Revision 1.19 2003/06/20 14:28:20 mohor
|
105 |
|
|
-- When hard_sync or resync occure we need to go to seg1 segment. Going to
|
106 |
|
|
-- sync segment is in that case blocked.
|
107 |
|
|
--
|
108 |
|
|
-- Revision 1.18 2003/06/17 15:53:33 mohor
|
109 |
|
|
-- clk_cnt reduced from [8:0] to [6:0].
|
110 |
|
|
--
|
111 |
|
|
-- Revision 1.17 2003/06/17 14:32:17 mohor
|
112 |
|
|
-- Removed few signals.
|
113 |
|
|
--
|
114 |
|
|
-- Revision 1.16 2003/06/16 13:57:58 mohor
|
115 |
|
|
-- tx_point generated one clk earlier. rx_i registered. Data corrected when
|
116 |
|
|
-- using extended mode.
|
117 |
|
|
--
|
118 |
|
|
-- Revision 1.15 2003/06/13 15:02:24 mohor
|
119 |
|
|
-- Synchronization is also needed when transmitting a message.
|
120 |
|
|
--
|
121 |
|
|
-- Revision 1.14 2003/06/13 14:55:11 mohor
|
122 |
|
|
-- Counters width changed.
|
123 |
|
|
--
|
124 |
|
|
-- Revision 1.13 2003/06/11 14:21:35 mohor
|
125 |
|
|
-- When switching to tx, sync stage is overjumped.
|
126 |
|
|
--
|
127 |
|
|
-- Revision 1.12 2003/02/14 20:17:01 mohor
|
128 |
|
|
-- Several registers added. Not finished, yet.
|
129 |
|
|
--
|
130 |
|
|
-- Revision 1.11 2003/02/09 18:40:29 mohor
|
131 |
|
|
-- Overload fixed. Hard synchronization also enabled at the last bit of
|
132 |
|
|
-- interframe.
|
133 |
|
|
--
|
134 |
|
|
-- Revision 1.10 2003/02/09 02:24:33 mohor
|
135 |
|
|
-- Bosch license warning added. Error counters finished. Overload frames
|
136 |
|
|
-- still need to be fixed.
|
137 |
|
|
--
|
138 |
|
|
-- Revision 1.9 2003/01/31 01:13:38 mohor
|
139 |
|
|
-- backup.
|
140 |
|
|
--
|
141 |
|
|
-- Revision 1.8 2003/01/10 17:51:34 mohor
|
142 |
|
|
-- Temporary version (backup).
|
143 |
|
|
--
|
144 |
|
|
-- Revision 1.7 2003/01/08 02:10:53 mohor
|
145 |
|
|
-- Acceptance filter added.
|
146 |
|
|
--
|
147 |
|
|
-- Revision 1.6 2002/12/28 04:13:23 mohor
|
148 |
|
|
-- Backup version.
|
149 |
|
|
--
|
150 |
|
|
-- Revision 1.5 2002/12/27 00:12:52 mohor
|
151 |
|
|
-- Header changed, testbench improved to send a frame (crc still missing).
|
152 |
|
|
--
|
153 |
|
|
-- Revision 1.4 2002/12/26 01:33:05 mohor
|
154 |
|
|
-- Tripple sampling supported.
|
155 |
|
|
--
|
156 |
|
|
-- Revision 1.3 2002/12/25 23:44:16 mohor
|
157 |
|
|
-- Commented lines removed.
|
158 |
|
|
--
|
159 |
|
|
-- Revision 1.2 2002/12/25 14:17:00 mohor
|
160 |
|
|
-- Synchronization working.
|
161 |
|
|
--
|
162 |
|
|
-- Revision 1.1.1.1 2002/12/20 16:39:21 mohor
|
163 |
|
|
-- Initial
|
164 |
|
|
--
|
165 |
|
|
--
|
166 |
|
|
--
|
167 |
|
|
-- synopsys translate_off
|
168 |
|
|
--`include "can_defines.v"
|
169 |
|
|
-- synopsys translate_on
|
170 |
|
|
|
171 |
|
|
LIBRARY ieee;
|
172 |
|
|
USE ieee.std_logic_1164.all;
|
173 |
|
|
USE ieee.numeric_std.all;
|
174 |
|
|
|
175 |
|
|
library grlib;
|
176 |
|
|
use grlib.stdlib.all;
|
177 |
|
|
|
178 |
|
|
ENTITY can_btl_core_sync IS
|
179 |
|
|
PORT (
|
180 |
|
|
clk : IN std_logic;
|
181 |
|
|
rst : IN std_logic;
|
182 |
|
|
rx : IN std_logic;
|
183 |
|
|
tx : IN std_logic;
|
184 |
|
|
-- Bus Timing 0 register
|
185 |
|
|
baud_r_presc : IN std_logic_vector(10 DOWNTO 0); --##
|
186 |
|
|
sync_jump_width : IN std_logic_vector(1 DOWNTO 0);
|
187 |
|
|
-- Bus Timing 1 register
|
188 |
|
|
time_segment1 : IN std_logic_vector(3 DOWNTO 0);
|
189 |
|
|
time_segment2 : IN std_logic_vector(2 DOWNTO 0);
|
190 |
|
|
triple_sampling : IN std_logic;
|
191 |
|
|
-- Output signals from this module
|
192 |
|
|
sample_point : OUT std_logic;
|
193 |
|
|
sampled_bit : OUT std_logic;
|
194 |
|
|
sampled_bit_q : OUT std_logic;
|
195 |
|
|
tx_point : OUT std_logic;
|
196 |
|
|
hard_sync : OUT std_logic;
|
197 |
|
|
-- Output from can_bsp_core_sync module
|
198 |
|
|
rx_idle : IN std_logic;
|
199 |
|
|
rx_inter : IN std_logic;
|
200 |
|
|
transmitting : IN std_logic;
|
201 |
|
|
transmitter : IN std_logic;
|
202 |
|
|
go_rx_inter : IN std_logic;
|
203 |
|
|
tx_next : IN std_logic;
|
204 |
|
|
go_overload_frame : IN std_logic;
|
205 |
|
|
go_error_frame : IN std_logic;
|
206 |
|
|
go_tx : IN std_logic;
|
207 |
|
|
send_ack : IN std_logic;
|
208 |
|
|
node_error_passive : IN std_logic);
|
209 |
|
|
END ENTITY can_btl_core_sync;
|
210 |
|
|
|
211 |
|
|
ARCHITECTURE RTL OF can_btl_core_sync IS
|
212 |
|
|
|
213 |
|
|
TYPE xhdl_46 IS ARRAY (0 TO 7) OF std_logic_vector(7 DOWNTO 0);
|
214 |
|
|
|
215 |
|
|
SIGNAL clk_cnt : std_logic_vector(10 DOWNTO 0); --##
|
216 |
|
|
SIGNAL clk_en : std_logic;
|
217 |
|
|
SIGNAL clk_en_q : std_logic;
|
218 |
|
|
SIGNAL sync_blocked : std_logic;
|
219 |
|
|
SIGNAL hard_sync_blocked : std_logic;
|
220 |
|
|
SIGNAL quant_cnt : std_logic_vector(4 DOWNTO 0);
|
221 |
|
|
SIGNAL delay : std_logic_vector(3 DOWNTO 0);
|
222 |
|
|
SIGNAL sync : std_logic;
|
223 |
|
|
SIGNAL seg1 : std_logic;
|
224 |
|
|
SIGNAL seg2 : std_logic;
|
225 |
|
|
SIGNAL resync_latched : std_logic;
|
226 |
|
|
SIGNAL sample : std_logic_vector(1 DOWNTO 0);
|
227 |
|
|
SIGNAL tx_next_sp : std_logic;
|
228 |
|
|
SIGNAL go_sync : std_logic;
|
229 |
|
|
SIGNAL go_seg1 : std_logic;
|
230 |
|
|
SIGNAL go_seg2 : std_logic;
|
231 |
|
|
SIGNAL preset_cnt : std_logic_vector(10 DOWNTO 0); --##
|
232 |
|
|
SIGNAL sync_window : std_logic;
|
233 |
|
|
SIGNAL resync : std_logic;
|
234 |
|
|
-- when transmitting 0 with positive error delay is set to 0
|
235 |
|
|
SIGNAL temp_xhdl6 : std_logic_vector(4 DOWNTO 0);
|
236 |
|
|
SIGNAL sample_point_xhdl1 : std_logic;
|
237 |
|
|
SIGNAL sampled_bit_xhdl2 : std_logic;
|
238 |
|
|
SIGNAL sampled_bit_q_xhdl3 : std_logic;
|
239 |
|
|
SIGNAL tx_point_xhdl4 : std_logic;
|
240 |
|
|
SIGNAL hard_sync_xhdl5 : std_logic;
|
241 |
|
|
|
242 |
|
|
signal time_segment1_ext, delay_ext, add_ext: std_logic_vector(4 DOWNTO 0); --##
|
243 |
|
|
|
244 |
|
|
BEGIN
|
245 |
|
|
sample_point <= sample_point_xhdl1;
|
246 |
|
|
sampled_bit <= sampled_bit_xhdl2;
|
247 |
|
|
sampled_bit_q <= sampled_bit_q_xhdl3;
|
248 |
|
|
tx_point <= tx_point_xhdl4;
|
249 |
|
|
hard_sync <= hard_sync_xhdl5;
|
250 |
|
|
-- preset_cnt <= (('0' & baud_r_presc) + 1) & "0" ;
|
251 |
|
|
--## preset_cnt <= "00" & baud_r_presc + '1';
|
252 |
|
|
preset_cnt <= baud_r_presc; --## --## extend scaler
|
253 |
|
|
|
254 |
|
|
hard_sync_xhdl5 <= (((rx_idle OR rx_inter) AND (NOT rx)) AND sampled_bit_xhdl2) AND (NOT hard_sync_blocked) ;
|
255 |
|
|
resync <= ((((NOT rx_idle) AND (NOT rx_inter)) AND (NOT rx)) AND sampled_bit_xhdl2) AND (NOT sync_blocked) ;
|
256 |
|
|
|
257 |
|
|
-- Generating general enable signal that defines baud rate.
|
258 |
|
|
PROCESS (clk, rst)
|
259 |
|
|
BEGIN
|
260 |
|
|
-- IF (rst = '1') THEN
|
261 |
|
|
-- clk_cnt <= "0000000";
|
262 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
263 |
|
|
IF (rst = '1') THEN
|
264 |
|
|
clk_cnt <= (others => '0'); --##
|
265 |
|
|
ELSIF (clk_cnt >= preset_cnt) then --##
|
266 |
|
|
clk_cnt <= (others => '0'); --##
|
267 |
|
|
ELSE
|
268 |
|
|
clk_cnt <= clk_cnt + '1' ; --##
|
269 |
|
|
END IF;
|
270 |
|
|
END IF;
|
271 |
|
|
END PROCESS;
|
272 |
|
|
|
273 |
|
|
PROCESS (clk, rst)
|
274 |
|
|
BEGIN
|
275 |
|
|
-- IF (rst = '1') THEN
|
276 |
|
|
-- clk_en <= '0';
|
277 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
278 |
|
|
IF (rst = '1') THEN
|
279 |
|
|
clk_en <= '0';
|
280 |
|
|
ELSIF (clk_cnt = preset_cnt) then --##
|
281 |
|
|
clk_en <= '1' ;
|
282 |
|
|
ELSE
|
283 |
|
|
clk_en <= '0' ;
|
284 |
|
|
END IF;
|
285 |
|
|
END IF;
|
286 |
|
|
END PROCESS;
|
287 |
|
|
|
288 |
|
|
PROCESS (clk, rst)
|
289 |
|
|
BEGIN
|
290 |
|
|
-- IF (rst = '1') THEN
|
291 |
|
|
-- clk_en_q <= '0';
|
292 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
293 |
|
|
IF (rst = '1') THEN
|
294 |
|
|
clk_en_q <= '0';
|
295 |
|
|
ELSE
|
296 |
|
|
clk_en_q <= clk_en ;
|
297 |
|
|
END IF;
|
298 |
|
|
END IF;
|
299 |
|
|
END PROCESS;
|
300 |
|
|
-- Changing states
|
301 |
|
|
go_sync <= (((clk_en_q AND seg2) AND CONV_STD_LOGIC(quant_cnt(2 DOWNTO 0) = time_segment2)) AND (NOT hard_sync_xhdl5)) AND (NOT resync) ;
|
302 |
|
|
go_seg1 <= clk_en_q AND (sync OR hard_sync_xhdl5 OR ((resync AND seg2) AND sync_window) OR (resync_latched AND sync_window)) ;
|
303 |
|
|
|
304 |
|
|
time_segment1_ext <= '0' & time_segment1; --## fix comparison for max values
|
305 |
|
|
delay_ext <= '0' & delay; --##
|
306 |
|
|
add_ext <= time_segment1_ext + delay_ext; --##
|
307 |
|
|
|
308 |
|
|
go_seg2 <= clk_en_q AND ((seg1 AND (NOT hard_sync_xhdl5)) AND CONV_STD_LOGIC(quant_cnt = add_ext)) ;--##
|
309 |
|
|
--## go_seg2 <= clk_en_q AND ((seg1 AND (NOT hard_sync_xhdl5)) AND CONV_STD_LOGIC(quant_cnt = ( '0' & (time_segment1 + delay)))) ;
|
310 |
|
|
|
311 |
|
|
PROCESS (clk, rst)
|
312 |
|
|
BEGIN
|
313 |
|
|
-- IF (rst = '1') THEN
|
314 |
|
|
-- tx_point_xhdl4 <= '0';
|
315 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
316 |
|
|
tx_point_xhdl4 <= (NOT tx_point_xhdl4 AND seg2) AND ((clk_en AND CONV_STD_LOGIC(quant_cnt(2 DOWNTO 0) = time_segment2)) OR ((clk_en OR clk_en_q) AND (resync OR hard_sync_xhdl5))) ; -- When transmitter we should transmit as soon as possible.
|
317 |
|
|
IF (rst = '1') THEN
|
318 |
|
|
tx_point_xhdl4 <= '0';
|
319 |
|
|
END IF;
|
320 |
|
|
END IF;
|
321 |
|
|
END PROCESS;
|
322 |
|
|
|
323 |
|
|
-- When early edge is detected outside of the SJW field, synchronization request is latched and performed when
|
324 |
|
|
-- When early edge is detected outside of the SJW field, synchronization request is latched and performed when
|
325 |
|
|
-- SJW is reached
|
326 |
|
|
|
327 |
|
|
PROCESS (clk, rst)
|
328 |
|
|
BEGIN
|
329 |
|
|
-- IF (rst = '1') THEN
|
330 |
|
|
-- resync_latched <= '0';
|
331 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
332 |
|
|
IF (((resync AND seg2) AND (NOT sync_window)) = '1') THEN
|
333 |
|
|
resync_latched <= '1' ;
|
334 |
|
|
ELSE
|
335 |
|
|
IF (go_seg1 = '1') THEN
|
336 |
|
|
resync_latched <= '0';
|
337 |
|
|
END IF;
|
338 |
|
|
END IF;
|
339 |
|
|
IF (rst = '1') THEN
|
340 |
|
|
resync_latched <= '0';
|
341 |
|
|
END IF;
|
342 |
|
|
END IF;
|
343 |
|
|
END PROCESS;
|
344 |
|
|
|
345 |
|
|
-- Synchronization stage/segment
|
346 |
|
|
PROCESS (clk, rst)
|
347 |
|
|
BEGIN
|
348 |
|
|
-- IF (rst = '1') THEN
|
349 |
|
|
-- sync <= '0';
|
350 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
351 |
|
|
IF (clk_en_q = '1') THEN
|
352 |
|
|
sync <= go_sync ;
|
353 |
|
|
END IF;
|
354 |
|
|
IF (rst = '1') THEN
|
355 |
|
|
sync <= '0';
|
356 |
|
|
END IF;
|
357 |
|
|
END IF;
|
358 |
|
|
END PROCESS;
|
359 |
|
|
|
360 |
|
|
-- Seg1 stage/segment (together with propagation segment which is 1 quant long)
|
361 |
|
|
PROCESS (clk, rst)
|
362 |
|
|
BEGIN
|
363 |
|
|
-- IF (rst = '1') THEN
|
364 |
|
|
-- seg1 <= '1';
|
365 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
366 |
|
|
IF (go_seg1 = '1') THEN
|
367 |
|
|
seg1 <= '1' ;
|
368 |
|
|
ELSE
|
369 |
|
|
IF (go_seg2 = '1') THEN
|
370 |
|
|
seg1 <= '0' ;
|
371 |
|
|
END IF;
|
372 |
|
|
END IF;
|
373 |
|
|
IF (rst = '1') THEN
|
374 |
|
|
seg1 <= '1';
|
375 |
|
|
END IF;
|
376 |
|
|
END IF;
|
377 |
|
|
END PROCESS;
|
378 |
|
|
|
379 |
|
|
-- Seg2 stage/segment
|
380 |
|
|
PROCESS (clk, rst)
|
381 |
|
|
BEGIN
|
382 |
|
|
-- IF (rst = '1') THEN
|
383 |
|
|
-- seg2 <= '0';
|
384 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
385 |
|
|
IF (go_seg2 = '1') THEN
|
386 |
|
|
seg2 <= '1' ;
|
387 |
|
|
ELSE
|
388 |
|
|
IF ((go_sync OR go_seg1) = '1') THEN
|
389 |
|
|
seg2 <= '0' ;
|
390 |
|
|
END IF;
|
391 |
|
|
END IF;
|
392 |
|
|
IF (rst = '1') THEN
|
393 |
|
|
seg2 <= '0';
|
394 |
|
|
END IF;
|
395 |
|
|
END IF;
|
396 |
|
|
END PROCESS;
|
397 |
|
|
|
398 |
|
|
-- Quant counter
|
399 |
|
|
PROCESS (clk, rst)
|
400 |
|
|
BEGIN
|
401 |
|
|
-- IF (rst = '1') THEN
|
402 |
|
|
-- quant_cnt <= "00000";
|
403 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
404 |
|
|
IF ((go_sync OR go_seg1 OR go_seg2) = '1') THEN
|
405 |
|
|
quant_cnt <= "00000" ;
|
406 |
|
|
ELSE
|
407 |
|
|
IF (clk_en_q = '1') THEN
|
408 |
|
|
quant_cnt <= quant_cnt + "00001" ;
|
409 |
|
|
END IF;
|
410 |
|
|
END IF;
|
411 |
|
|
IF (rst = '1') THEN
|
412 |
|
|
quant_cnt <= "00000";
|
413 |
|
|
END IF;
|
414 |
|
|
END IF;
|
415 |
|
|
END PROCESS;
|
416 |
|
|
temp_xhdl6 <= ("0" & ("00" & sync_jump_width + "0001")) WHEN (quant_cnt > "000" & sync_jump_width) ELSE (quant_cnt + "00001");
|
417 |
|
|
|
418 |
|
|
-- When late edge is detected (in seg1 stage), stage seg1 is prolonged.
|
419 |
|
|
PROCESS (clk, rst)
|
420 |
|
|
BEGIN
|
421 |
|
|
-- IF (rst = '1') THEN
|
422 |
|
|
-- delay <= "0000";
|
423 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
424 |
|
|
IF (((resync AND seg1) AND (NOT transmitting OR (transmitting AND (tx_next_sp OR (tx AND (NOT rx)))))) = '1') THEN
|
425 |
|
|
delay <= temp_xhdl6(3 DOWNTO 0) ;
|
426 |
|
|
ELSE
|
427 |
|
|
IF ((go_sync OR go_seg1) = '1') THEN
|
428 |
|
|
delay <= "0000" ;
|
429 |
|
|
END IF;
|
430 |
|
|
END IF;
|
431 |
|
|
IF (rst = '1') THEN
|
432 |
|
|
delay <= "0000";
|
433 |
|
|
END IF;
|
434 |
|
|
END IF;
|
435 |
|
|
END PROCESS;
|
436 |
|
|
-- If early edge appears within this window (in seg2 stage), phase error is fully compensated
|
437 |
|
|
sync_window <= CONV_STD_LOGIC((time_segment2 - quant_cnt(2 DOWNTO 0)) < ('0' & (sync_jump_width + "01"))) ;
|
438 |
|
|
|
439 |
|
|
-- Sampling data (memorizing two samples all the time).
|
440 |
|
|
|
441 |
|
|
PROCESS (clk, rst)
|
442 |
|
|
BEGIN
|
443 |
|
|
-- IF (rst = '1') THEN
|
444 |
|
|
-- sample <= "11";
|
445 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
446 |
|
|
IF (clk_en_q = '1') THEN
|
447 |
|
|
sample <= sample(0) & rx;
|
448 |
|
|
END IF;
|
449 |
|
|
IF (rst = '1') THEN
|
450 |
|
|
sample <= "11";
|
451 |
|
|
END IF;
|
452 |
|
|
END IF;
|
453 |
|
|
END PROCESS;
|
454 |
|
|
|
455 |
|
|
-- When enabled, tripple sampling is done here.
|
456 |
|
|
|
457 |
|
|
PROCESS (clk, rst)
|
458 |
|
|
BEGIN
|
459 |
|
|
-- IF (rst = '1') THEN
|
460 |
|
|
-- sampled_bit_xhdl2 <= '1';
|
461 |
|
|
-- sampled_bit_q_xhdl3 <= '1';
|
462 |
|
|
-- sample_point_xhdl1 <= '0';
|
463 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
464 |
|
|
IF (go_error_frame = '1') THEN
|
465 |
|
|
sampled_bit_q_xhdl3 <= sampled_bit_xhdl2 ;
|
466 |
|
|
sample_point_xhdl1 <= '0' ;
|
467 |
|
|
ELSE
|
468 |
|
|
IF ((clk_en_q AND (NOT hard_sync_xhdl5)) = '1') THEN
|
469 |
|
|
--## IF ((seg1 AND CONV_STD_LOGIC(quant_cnt = ('0' & (time_segment1 + delay)))) = '1') THEN
|
470 |
|
|
IF ((seg1 AND CONV_STD_LOGIC(quant_cnt = add_ext )) = '1') then --##
|
471 |
|
|
sample_point_xhdl1 <= '1' ;
|
472 |
|
|
sampled_bit_q_xhdl3 <= sampled_bit_xhdl2 ;
|
473 |
|
|
IF (triple_sampling = '1') THEN
|
474 |
|
|
sampled_bit_xhdl2 <= (sample(0) AND sample(1)) OR (sample(0) AND rx) OR (sample(1) AND rx) ;
|
475 |
|
|
ELSE
|
476 |
|
|
sampled_bit_xhdl2 <= rx ;
|
477 |
|
|
END IF;
|
478 |
|
|
-- kc fix
|
479 |
|
|
ELSE
|
480 |
|
|
sample_point_xhdl1 <= '0' ;
|
481 |
|
|
--
|
482 |
|
|
END IF;
|
483 |
|
|
ELSE
|
484 |
|
|
sample_point_xhdl1 <= '0' ;
|
485 |
|
|
END IF;
|
486 |
|
|
END IF;
|
487 |
|
|
IF (rst = '1') THEN
|
488 |
|
|
sampled_bit_xhdl2 <= '1';
|
489 |
|
|
sampled_bit_q_xhdl3 <= '1';
|
490 |
|
|
sample_point_xhdl1 <= '0';
|
491 |
|
|
END IF;
|
492 |
|
|
END IF;
|
493 |
|
|
END PROCESS;
|
494 |
|
|
|
495 |
|
|
-- tx_next_sp shows next value that will be driven on the TX. When driving 1 and receiving 0 we
|
496 |
|
|
-- need to synchronize (even when we are a transmitter)
|
497 |
|
|
|
498 |
|
|
PROCESS (clk, rst)
|
499 |
|
|
BEGIN
|
500 |
|
|
-- IF (rst = '1') THEN
|
501 |
|
|
-- tx_next_sp <= '0';
|
502 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
503 |
|
|
IF ((go_overload_frame OR (go_error_frame AND (NOT node_error_passive)) OR go_tx OR send_ack) = '1') THEN
|
504 |
|
|
tx_next_sp <= '0' ;
|
505 |
|
|
ELSE
|
506 |
|
|
IF ((go_error_frame AND node_error_passive) = '1') THEN
|
507 |
|
|
tx_next_sp <= '1' ;
|
508 |
|
|
ELSE
|
509 |
|
|
IF (sample_point_xhdl1 = '1') THEN
|
510 |
|
|
tx_next_sp <= tx_next ;
|
511 |
|
|
END IF;
|
512 |
|
|
END IF;
|
513 |
|
|
END IF;
|
514 |
|
|
IF (rst = '1') THEN
|
515 |
|
|
tx_next_sp <= '0';
|
516 |
|
|
END IF;
|
517 |
|
|
END IF;
|
518 |
|
|
END PROCESS;
|
519 |
|
|
|
520 |
|
|
-- Blocking synchronization (can occur only once in a bit time)
|
521 |
|
|
PROCESS (clk, rst)
|
522 |
|
|
BEGIN
|
523 |
|
|
-- IF (rst = '1') THEN
|
524 |
|
|
-- sync_blocked <= '1' ;
|
525 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
526 |
|
|
IF (clk_en_q = '1') THEN
|
527 |
|
|
IF (resync = '1') THEN
|
528 |
|
|
sync_blocked <= '1' ;
|
529 |
|
|
ELSE
|
530 |
|
|
IF (go_seg2 = '1') THEN
|
531 |
|
|
sync_blocked <= '0' ;
|
532 |
|
|
END IF;
|
533 |
|
|
END IF;
|
534 |
|
|
END IF;
|
535 |
|
|
IF (rst = '1') THEN
|
536 |
|
|
sync_blocked <= '1' ;
|
537 |
|
|
END IF;
|
538 |
|
|
END IF;
|
539 |
|
|
END PROCESS;
|
540 |
|
|
|
541 |
|
|
-- Blocking hard synchronization when occurs once or when we are transmitting a msg
|
542 |
|
|
PROCESS (clk, rst)
|
543 |
|
|
BEGIN
|
544 |
|
|
-- IF (rst = '1') THEN
|
545 |
|
|
-- hard_sync_blocked <= '0' ;
|
546 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
547 |
|
|
IF (((hard_sync_xhdl5 AND clk_en_q) OR ((((transmitting AND transmitter) OR go_tx) AND tx_point_xhdl4) AND (NOT tx_next))) = '1') THEN
|
548 |
|
|
hard_sync_blocked <= '1' ;
|
549 |
|
|
ELSE
|
550 |
|
|
IF ((go_rx_inter OR (((rx_idle OR rx_inter) AND sample_point_xhdl1) AND sampled_bit_xhdl2)) = '1') THEN
|
551 |
|
|
-- When a glitch performed synchronization
|
552 |
|
|
|
553 |
|
|
hard_sync_blocked <= '0' ;
|
554 |
|
|
END IF;
|
555 |
|
|
END IF;
|
556 |
|
|
IF (rst = '1') THEN
|
557 |
|
|
hard_sync_blocked <= '0' ;
|
558 |
|
|
END IF;
|
559 |
|
|
END IF;
|
560 |
|
|
END PROCESS;
|
561 |
|
|
|
562 |
|
|
END ARCHITECTURE RTL;
|
563 |
|
|
|
564 |
|
|
----------------------------------------------------------------------------------------------
|
565 |
|
|
--
|
566 |
|
|
-- VHDL file generated by X-HDL - Revision 3.2.53 Aug. 1, 2005
|
567 |
|
|
-- Tue Aug 9 07:33:51 2005
|
568 |
|
|
--
|
569 |
|
|
-- Input file : C:/Documents and Settings/BryantI/My Documents/tmp/can_top.v
|
570 |
|
|
-- Design name : can_crc_core_sync
|
571 |
|
|
-- Author :
|
572 |
|
|
-- Company : Actel
|
573 |
|
|
--
|
574 |
|
|
-- Description :
|
575 |
|
|
--
|
576 |
|
|
--
|
577 |
|
|
----------------------------------------------------------------------------------------------
|
578 |
|
|
--
|
579 |
|
|
--////////////////////////////////////////////////////////////////////
|
580 |
|
|
--// ////
|
581 |
|
|
--// can_crc_core_sync.v ////
|
582 |
|
|
--// ////
|
583 |
|
|
--// ////
|
584 |
|
|
--// This file is part of the CAN Protocol Controller ////
|
585 |
|
|
--// http://www.opencores.org/projects/can/ ////
|
586 |
|
|
--// ////
|
587 |
|
|
--// ////
|
588 |
|
|
--// Author(s): ////
|
589 |
|
|
--// Igor Mohor ////
|
590 |
|
|
--// igorm@opencores.org ////
|
591 |
|
|
--// ////
|
592 |
|
|
--// ////
|
593 |
|
|
--// All additional information is available in the README.txt ////
|
594 |
|
|
--// file. ////
|
595 |
|
|
--// ////
|
596 |
|
|
--////////////////////////////////////////////////////////////////////
|
597 |
|
|
--// ////
|
598 |
|
|
--// Copyright (C) 2002, 2003, 2004 Authors ////
|
599 |
|
|
--// ////
|
600 |
|
|
--// This source file may be used and distributed without ////
|
601 |
|
|
--// restriction provided that this copyright statement is not ////
|
602 |
|
|
--// removed from the file and that any derivative work contains ////
|
603 |
|
|
--// the original copyright notice and the associated disclaimer. ////
|
604 |
|
|
--// ////
|
605 |
|
|
--// This source file is free software; you can redistribute it ////
|
606 |
|
|
--// and/or modify it under the terms of the GNU Lesser General ////
|
607 |
|
|
--// Public License as published by the Free Software Foundation; ////
|
608 |
|
|
--// either version 2.1 of the License, or (at your option) any ////
|
609 |
|
|
--// later version. ////
|
610 |
|
|
--// ////
|
611 |
|
|
--// This source is distributed in the hope that it will be ////
|
612 |
|
|
--// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
613 |
|
|
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
614 |
|
|
--// PURPOSE. See the GNU Lesser General Public License for more ////
|
615 |
|
|
--// details. ////
|
616 |
|
|
--// ////
|
617 |
|
|
--// You should have received a copy of the GNU Lesser General ////
|
618 |
|
|
--// Public License along with this source; if not, download it ////
|
619 |
|
|
--// from http://www.opencores.org/lgpl.shtml ////
|
620 |
|
|
--// ////
|
621 |
|
|
--// The CAN protocol is developed by Robert Bosch GmbH and ////
|
622 |
|
|
--// protected by patents. Anybody who wants to implement this ////
|
623 |
|
|
--// CAN IP core on silicon has to obtain a CAN protocol license ////
|
624 |
|
|
--// from Bosch. ////
|
625 |
|
|
--// ////
|
626 |
|
|
--////////////////////////////////////////////////////////////////////
|
627 |
|
|
--
|
628 |
|
|
-- CVS Revision History
|
629 |
|
|
--
|
630 |
|
|
-- $Log: can_crc_core_sync.v,v $
|
631 |
|
|
-- Revision 1.5 2004/02/08 14:25:57 mohor
|
632 |
|
|
-- Header changed.
|
633 |
|
|
--
|
634 |
|
|
-- Revision 1.4 2003/07/16 13:16:51 mohor
|
635 |
|
|
-- Fixed according to the linter.
|
636 |
|
|
--
|
637 |
|
|
-- Revision 1.3 2003/02/10 16:02:11 mohor
|
638 |
|
|
-- CAN is working according to the specification. WB interface and more
|
639 |
|
|
-- registers (status, IRQ, ...) needs to be added.
|
640 |
|
|
--
|
641 |
|
|
-- Revision 1.2 2003/02/09 02:24:33 mohor
|
642 |
|
|
-- Bosch license warning added. Error counters finished. Overload frames
|
643 |
|
|
-- still need to be fixed.
|
644 |
|
|
--
|
645 |
|
|
-- Revision 1.1 2003/01/08 02:10:54 mohor
|
646 |
|
|
-- Acceptance filter added.
|
647 |
|
|
--
|
648 |
|
|
--
|
649 |
|
|
--
|
650 |
|
|
--
|
651 |
|
|
-- synopsys translate_off
|
652 |
|
|
--`include "can_defines.v"
|
653 |
|
|
-- synopsys translate_on
|
654 |
|
|
|
655 |
|
|
LIBRARY ieee;
|
656 |
|
|
USE ieee.std_logic_1164.all;
|
657 |
|
|
USE ieee.numeric_std.all;
|
658 |
|
|
|
659 |
|
|
library grlib;
|
660 |
|
|
use grlib.stdlib.all;
|
661 |
|
|
|
662 |
|
|
ENTITY can_crc_core_sync IS
|
663 |
|
|
PORT (
|
664 |
|
|
clk : IN std_logic;
|
665 |
|
|
data : IN std_logic;
|
666 |
|
|
enable : IN std_logic;
|
667 |
|
|
initialize : IN std_logic;
|
668 |
|
|
crc : OUT std_logic_vector(14 DOWNTO 0));
|
669 |
|
|
END ENTITY can_crc_core_sync;
|
670 |
|
|
|
671 |
|
|
ARCHITECTURE RTL OF can_crc_core_sync IS
|
672 |
|
|
|
673 |
|
|
TYPE xhdl_46 IS ARRAY (0 TO 7) OF std_logic_vector(7 DOWNTO 0);
|
674 |
|
|
|
675 |
|
|
SIGNAL crc_next : std_logic;
|
676 |
|
|
SIGNAL crc_tmp : std_logic_vector(14 DOWNTO 0);
|
677 |
|
|
SIGNAL crc_xhdl1 : std_logic_vector(14 DOWNTO 0);
|
678 |
|
|
|
679 |
|
|
BEGIN
|
680 |
|
|
crc <= crc_xhdl1;
|
681 |
|
|
crc_next <= data XOR crc_xhdl1(14) ;
|
682 |
|
|
crc_tmp <= crc_xhdl1(13 DOWNTO 0) & '0' ;
|
683 |
|
|
|
684 |
|
|
PROCESS (clk)
|
685 |
|
|
BEGIN
|
686 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
687 |
|
|
IF (initialize = '1') THEN
|
688 |
|
|
crc_xhdl1 <= "000000000000000";
|
689 |
|
|
ELSE
|
690 |
|
|
IF (enable = '1') THEN
|
691 |
|
|
IF (crc_next = '1') THEN
|
692 |
|
|
crc_xhdl1 <= crc_tmp XOR "100010110011001";
|
693 |
|
|
ELSE
|
694 |
|
|
crc_xhdl1 <= crc_tmp ;
|
695 |
|
|
END IF;
|
696 |
|
|
END IF;
|
697 |
|
|
END IF;
|
698 |
|
|
END IF;
|
699 |
|
|
END PROCESS;
|
700 |
|
|
|
701 |
|
|
END ARCHITECTURE RTL;
|
702 |
|
|
----------------------------------------------------------------------------------------------
|
703 |
|
|
--
|
704 |
|
|
-- VHDL file generated by X-HDL - Revision 3.2.53 Aug. 1, 2005
|
705 |
|
|
-- Tue Aug 9 07:33:51 2005
|
706 |
|
|
--
|
707 |
|
|
-- Input file : C:/Documents and Settings/BryantI/My Documents/tmp/can_top.v
|
708 |
|
|
-- Design name : can_ibo_core_sync
|
709 |
|
|
-- Author :
|
710 |
|
|
-- Company : Actel
|
711 |
|
|
--
|
712 |
|
|
-- Description :
|
713 |
|
|
--
|
714 |
|
|
--
|
715 |
|
|
----------------------------------------------------------------------------------------------
|
716 |
|
|
--
|
717 |
|
|
--////////////////////////////////////////////////////////////////////
|
718 |
|
|
--// ////
|
719 |
|
|
--// can_ibo_core_sync.v ////
|
720 |
|
|
--// ////
|
721 |
|
|
--// ////
|
722 |
|
|
--// This file is part of the CAN Protocol Controller ////
|
723 |
|
|
--// http://www.opencores.org/projects/can/ ////
|
724 |
|
|
--// ////
|
725 |
|
|
--// ////
|
726 |
|
|
--// Author(s): ////
|
727 |
|
|
--// Igor Mohor ////
|
728 |
|
|
--// igorm@opencores.org ////
|
729 |
|
|
--// ////
|
730 |
|
|
--// ////
|
731 |
|
|
--// All additional information is available in the README.txt ////
|
732 |
|
|
--// file. ////
|
733 |
|
|
--// ////
|
734 |
|
|
--////////////////////////////////////////////////////////////////////
|
735 |
|
|
--// ////
|
736 |
|
|
--// Copyright (C) 2002, 2003, 2004 Authors ////
|
737 |
|
|
--// ////
|
738 |
|
|
--// This source file may be used and distributed without ////
|
739 |
|
|
--// restriction provided that this copyright statement is not ////
|
740 |
|
|
--// removed from the file and that any derivative work contains ////
|
741 |
|
|
--// the original copyright notice and the associated disclaimer. ////
|
742 |
|
|
--// ////
|
743 |
|
|
--// This source file is free software; you can redistribute it ////
|
744 |
|
|
--// and/or modify it under the terms of the GNU Lesser General ////
|
745 |
|
|
--// Public License as published by the Free Software Foundation; ////
|
746 |
|
|
--// either version 2.1 of the License, or (at your option) any ////
|
747 |
|
|
--// later version. ////
|
748 |
|
|
--// ////
|
749 |
|
|
--// This source is distributed in the hope that it will be ////
|
750 |
|
|
--// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
751 |
|
|
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
752 |
|
|
--// PURPOSE. See the GNU Lesser General Public License for more ////
|
753 |
|
|
--// details. ////
|
754 |
|
|
--// ////
|
755 |
|
|
--// You should have received a copy of the GNU Lesser General ////
|
756 |
|
|
--// Public License along with this source; if not, download it ////
|
757 |
|
|
--// from http://www.opencores.org/lgpl.shtml ////
|
758 |
|
|
--// ////
|
759 |
|
|
--// The CAN protocol is developed by Robert Bosch GmbH and ////
|
760 |
|
|
--// protected by patents. Anybody who wants to implement this ////
|
761 |
|
|
--// CAN IP core on silicon has to obtain a CAN protocol license ////
|
762 |
|
|
--// from Bosch. ////
|
763 |
|
|
--// ////
|
764 |
|
|
--////////////////////////////////////////////////////////////////////
|
765 |
|
|
--
|
766 |
|
|
-- CVS Revision History
|
767 |
|
|
--
|
768 |
|
|
-- $Log: can_ibo_core_sync.v,v $
|
769 |
|
|
-- Revision 1.3 2004/02/08 14:31:44 mohor
|
770 |
|
|
-- Header changed.
|
771 |
|
|
--
|
772 |
|
|
-- Revision 1.2 2003/02/09 02:24:33 mohor
|
773 |
|
|
-- Bosch license warning added. Error counters finished. Overload frames
|
774 |
|
|
-- still need to be fixed.
|
775 |
|
|
--
|
776 |
|
|
-- Revision 1.1 2003/02/04 14:34:52 mohor
|
777 |
|
|
-- *** empty log message ***
|
778 |
|
|
--
|
779 |
|
|
--
|
780 |
|
|
--
|
781 |
|
|
--
|
782 |
|
|
-- synopsys translate_off
|
783 |
|
|
--`include "can_defines.v"
|
784 |
|
|
-- synopsys translate_on
|
785 |
|
|
-- This module only inverts bit order
|
786 |
|
|
LIBRARY ieee;
|
787 |
|
|
USE ieee.std_logic_1164.all;
|
788 |
|
|
|
789 |
|
|
library grlib;
|
790 |
|
|
use grlib.stdlib.all;
|
791 |
|
|
|
792 |
|
|
ENTITY can_ibo_core_sync IS
|
793 |
|
|
PORT (
|
794 |
|
|
di : IN std_logic_vector(7 DOWNTO 0);
|
795 |
|
|
do : OUT std_logic_vector(7 DOWNTO 0));
|
796 |
|
|
END ENTITY can_ibo_core_sync;
|
797 |
|
|
|
798 |
|
|
ARCHITECTURE RTL OF can_ibo_core_sync IS
|
799 |
|
|
|
800 |
|
|
TYPE xhdl_15 IS ARRAY (0 TO 63) OF std_logic_vector(7 DOWNTO 0);
|
801 |
|
|
TYPE xhdl_16 IS ARRAY (0 TO 63) OF std_logic_vector(3 DOWNTO 0);
|
802 |
|
|
TYPE xhdl_17 IS ARRAY (0 TO 63) OF std_logic;
|
803 |
|
|
TYPE xhdl_46 IS ARRAY (0 TO 7) OF std_logic_vector(7 DOWNTO 0);
|
804 |
|
|
|
805 |
|
|
SIGNAL do_xhdl1 : std_logic_vector(7 DOWNTO 0);
|
806 |
|
|
|
807 |
|
|
BEGIN
|
808 |
|
|
do <= do_xhdl1;
|
809 |
|
|
do_xhdl1(0) <= di(7) ;
|
810 |
|
|
do_xhdl1(1) <= di(6) ;
|
811 |
|
|
do_xhdl1(2) <= di(5) ;
|
812 |
|
|
do_xhdl1(3) <= di(4) ;
|
813 |
|
|
do_xhdl1(4) <= di(3) ;
|
814 |
|
|
do_xhdl1(5) <= di(2) ;
|
815 |
|
|
do_xhdl1(6) <= di(1) ;
|
816 |
|
|
do_xhdl1(7) <= di(0) ;
|
817 |
|
|
|
818 |
|
|
END ARCHITECTURE RTL;
|
819 |
|
|
----------------------------------------------------------------------------------------------
|
820 |
|
|
--
|
821 |
|
|
-- VHDL file generated by X-HDL - Revision 3.2.53 Aug. 1, 2005
|
822 |
|
|
-- Tue Aug 9 07:33:51 2005
|
823 |
|
|
--
|
824 |
|
|
-- Input file : C:/Documents and Settings/BryantI/My Documents/tmp/can_top.v
|
825 |
|
|
-- Design name : can_bsp_core_sync
|
826 |
|
|
-- Author :
|
827 |
|
|
-- Company : Actel
|
828 |
|
|
--
|
829 |
|
|
-- Description :
|
830 |
|
|
--
|
831 |
|
|
--
|
832 |
|
|
----------------------------------------------------------------------------------------------
|
833 |
|
|
--
|
834 |
|
|
--////////////////////////////////////////////////////////////////////
|
835 |
|
|
--// ////
|
836 |
|
|
--// can_bsp_core_sync.v ////
|
837 |
|
|
--// ////
|
838 |
|
|
--// ////
|
839 |
|
|
--// This file is part of the CAN Protocol Controller ////
|
840 |
|
|
--// http://www.opencores.org/projects/can/ ////
|
841 |
|
|
--// ////
|
842 |
|
|
--// ////
|
843 |
|
|
--// Author(s): ////
|
844 |
|
|
--// Igor Mohor ////
|
845 |
|
|
--// igorm@opencores.org ////
|
846 |
|
|
--// ////
|
847 |
|
|
--// ////
|
848 |
|
|
--// All additional information is available in the README.txt ////
|
849 |
|
|
--// file. ////
|
850 |
|
|
--// ////
|
851 |
|
|
--////////////////////////////////////////////////////////////////////
|
852 |
|
|
--// ////
|
853 |
|
|
--// Copyright (C) 2002, 2003, 2004 Authors ////
|
854 |
|
|
--// ////
|
855 |
|
|
--// This source file may be used and distributed without ////
|
856 |
|
|
--// restriction provided that this copyright statement is not ////
|
857 |
|
|
--// removed from the file and that any derivative work contains ////
|
858 |
|
|
--// the original copyright notice and the associated disclaimer. ////
|
859 |
|
|
--// ////
|
860 |
|
|
--// This source file is free software; you can redistribute it ////
|
861 |
|
|
--// and/or modify it under the terms of the GNU Lesser General ////
|
862 |
|
|
--// Public License as published by the Free Software Foundation; ////
|
863 |
|
|
--// either version 2.1 of the License, or (at your option) any ////
|
864 |
|
|
--// later version. ////
|
865 |
|
|
--// ////
|
866 |
|
|
--// This source is distributed in the hope that it will be ////
|
867 |
|
|
--// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
868 |
|
|
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
869 |
|
|
--// PURPOSE. See the GNU Lesser General Public License for more ////
|
870 |
|
|
--// details. ////
|
871 |
|
|
--// ////
|
872 |
|
|
--// You should have received a copy of the GNU Lesser General ////
|
873 |
|
|
--// Public License along with this source; if not, download it ////
|
874 |
|
|
--// from http://www.opencores.org/lgpl.shtml ////
|
875 |
|
|
--// ////
|
876 |
|
|
--// The CAN protocol is developed by Robert Bosch GmbH and ////
|
877 |
|
|
--// protected by patents. Anybody who wants to implement this ////
|
878 |
|
|
--// CAN IP core on silicon has to obtain a CAN protocol license ////
|
879 |
|
|
--// from Bosch. ////
|
880 |
|
|
--// ////
|
881 |
|
|
--////////////////////////////////////////////////////////////////////
|
882 |
|
|
--
|
883 |
|
|
-- CVS Revision History
|
884 |
|
|
--
|
885 |
|
|
-- $Log: can_bsp_core_sync.v,v $
|
886 |
|
|
-- Revision 1.52 2004/11/18 12:39:21 igorm
|
887 |
|
|
-- Fixes for compatibility after the SW reset.
|
888 |
|
|
--
|
889 |
|
|
-- Revision 1.51 2004/11/15 18:23:21 igorm
|
890 |
|
|
-- When CAN was reset by setting the reset_mode signal in mode register, it
|
891 |
|
|
-- was possible that CAN was blocked for a short period of time. Problem
|
892 |
|
|
-- occured very rarly.
|
893 |
|
|
--
|
894 |
|
|
-- Revision 1.50 2004/10/27 18:51:36 igorm
|
895 |
|
|
-- Fixed synchronization problem in real hardware when 0xf is used for TSEG1.
|
896 |
|
|
--
|
897 |
|
|
-- Revision 1.49 2004/10/25 06:37:51 igorm
|
898 |
|
|
-- Arbitration bug fixed.
|
899 |
|
|
--
|
900 |
|
|
-- Revision 1.48 2004/05/12 15:58:41 igorm
|
901 |
|
|
-- Core improved to pass all tests with the Bosch VHDL Reference system.
|
902 |
|
|
--
|
903 |
|
|
-- Revision 1.47 2004/02/08 14:24:10 mohor
|
904 |
|
|
-- Error counters changed.
|
905 |
|
|
--
|
906 |
|
|
-- Revision 1.46 2003/10/17 05:55:20 markom
|
907 |
|
|
-- mbist signals updated according to newest convention
|
908 |
|
|
--
|
909 |
|
|
-- Revision 1.45 2003/09/30 21:14:33 mohor
|
910 |
|
|
-- Error counters changed.
|
911 |
|
|
--
|
912 |
|
|
-- Revision 1.44 2003/09/30 00:55:12 mohor
|
913 |
|
|
-- Error counters fixed to be compatible with Bosch VHDL reference model.
|
914 |
|
|
-- Small synchronization changes.
|
915 |
|
|
--
|
916 |
|
|
-- Revision 1.43 2003/09/25 18:55:49 mohor
|
917 |
|
|
-- Synchronization changed, error counters fixed.
|
918 |
|
|
--
|
919 |
|
|
-- Revision 1.42 2003/08/29 07:01:14 mohor
|
920 |
|
|
-- When detecting bus-free, signal bus_free_cnt_en was cleared to zero
|
921 |
|
|
-- although the last sampled bit was zero instead of one.
|
922 |
|
|
--
|
923 |
|
|
-- Revision 1.41 2003/07/18 15:23:31 tadejm
|
924 |
|
|
-- Tx and rx length are limited to 8 bytes regardless to the DLC value.
|
925 |
|
|
--
|
926 |
|
|
-- Revision 1.40 2003/07/16 15:10:17 mohor
|
927 |
|
|
-- Fixed according to the linter.
|
928 |
|
|
--
|
929 |
|
|
-- Revision 1.39 2003/07/16 13:12:46 mohor
|
930 |
|
|
-- Fixed according to the linter.
|
931 |
|
|
--
|
932 |
|
|
-- Revision 1.38 2003/07/10 01:59:04 tadejm
|
933 |
|
|
-- Synchronization fixed. In some strange cases it didn't work according to
|
934 |
|
|
-- the VHDL reference model.
|
935 |
|
|
--
|
936 |
|
|
-- Revision 1.37 2003/07/07 11:21:37 mohor
|
937 |
|
|
-- Little fixes (to fix warnings).
|
938 |
|
|
--
|
939 |
|
|
-- Revision 1.36 2003/07/03 09:32:20 mohor
|
940 |
|
|
-- Synchronization changed.
|
941 |
|
|
--
|
942 |
|
|
-- Revision 1.35 2003/06/27 20:56:12 simons
|
943 |
|
|
-- Virtual silicon ram instances added.
|
944 |
|
|
--
|
945 |
|
|
-- Revision 1.34 2003/06/22 09:43:03 mohor
|
946 |
|
|
-- synthesi full_case parallel_case fixed.
|
947 |
|
|
--
|
948 |
|
|
-- Revision 1.33 2003/06/21 12:16:30 mohor
|
949 |
|
|
-- paralel_case and full_case compiler directives added to case statements.
|
950 |
|
|
--
|
951 |
|
|
-- Revision 1.32 2003/06/17 14:28:32 mohor
|
952 |
|
|
-- Form error was detected when stuff bit occured at the end of crc.
|
953 |
|
|
--
|
954 |
|
|
-- Revision 1.31 2003/06/16 14:31:29 tadejm
|
955 |
|
|
-- Bit stuffing corrected when stuffing comes at the end of the crc.
|
956 |
|
|
--
|
957 |
|
|
-- Revision 1.30 2003/06/16 13:57:58 mohor
|
958 |
|
|
-- tx_point generated one clk earlier. rx_i registered. Data corrected when
|
959 |
|
|
-- using extended mode.
|
960 |
|
|
--
|
961 |
|
|
-- Revision 1.29 2003/06/11 14:21:35 mohor
|
962 |
|
|
-- When switching to tx, sync stage is overjumped.
|
963 |
|
|
--
|
964 |
|
|
-- Revision 1.28 2003/03/01 22:53:33 mohor
|
965 |
|
|
-- Actel APA ram supported.
|
966 |
|
|
--
|
967 |
|
|
-- Revision 1.27 2003/02/20 00:26:02 mohor
|
968 |
|
|
-- When a dominant bit was detected at the third bit of the intermission and
|
969 |
|
|
-- node had a message to transmit, bit_stuff error could occur. Fixed.
|
970 |
|
|
--
|
971 |
|
|
-- Revision 1.26 2003/02/19 23:21:54 mohor
|
972 |
|
|
-- When bit error occured while active error flag was transmitted, counter was
|
973 |
|
|
-- not incremented.
|
974 |
|
|
--
|
975 |
|
|
-- Revision 1.25 2003/02/19 14:44:03 mohor
|
976 |
|
|
-- CAN core finished. Host interface added. Registers finished.
|
977 |
|
|
-- Synchronization to the wishbone finished.
|
978 |
|
|
--
|
979 |
|
|
-- Revision 1.24 2003/02/18 00:10:15 mohor
|
980 |
|
|
-- Most of the registers added. Registers "arbitration lost capture", "error code
|
981 |
|
|
-- capture" + few more still need to be added.
|
982 |
|
|
--
|
983 |
|
|
-- Revision 1.23 2003/02/14 20:17:01 mohor
|
984 |
|
|
-- Several registers added. Not finished, yet.
|
985 |
|
|
--
|
986 |
|
|
-- Revision 1.22 2003/02/12 14:23:59 mohor
|
987 |
|
|
-- abort_tx added. Bit destuff fixed.
|
988 |
|
|
--
|
989 |
|
|
-- Revision 1.21 2003/02/11 00:56:06 mohor
|
990 |
|
|
-- Wishbone interface added.
|
991 |
|
|
--
|
992 |
|
|
-- Revision 1.20 2003/02/10 16:02:11 mohor
|
993 |
|
|
-- CAN is working according to the specification. WB interface and more
|
994 |
|
|
-- registers (status, IRQ, ...) needs to be added.
|
995 |
|
|
--
|
996 |
|
|
-- Revision 1.19 2003/02/09 18:40:29 mohor
|
997 |
|
|
-- Overload fixed. Hard synchronization also enabled at the last bit of
|
998 |
|
|
-- interframe.
|
999 |
|
|
--
|
1000 |
|
|
-- Revision 1.18 2003/02/09 02:24:33 mohor
|
1001 |
|
|
-- Bosch license warning added. Error counters finished. Overload frames
|
1002 |
|
|
-- still need to be fixed.
|
1003 |
|
|
--
|
1004 |
|
|
-- Revision 1.17 2003/02/04 17:24:41 mohor
|
1005 |
|
|
-- Backup.
|
1006 |
|
|
--
|
1007 |
|
|
-- Revision 1.16 2003/02/04 14:34:52 mohor
|
1008 |
|
|
-- *** empty log message ***
|
1009 |
|
|
--
|
1010 |
|
|
-- Revision 1.15 2003/01/31 01:13:37 mohor
|
1011 |
|
|
-- backup.
|
1012 |
|
|
--
|
1013 |
|
|
-- Revision 1.14 2003/01/16 13:36:19 mohor
|
1014 |
|
|
-- Form error supported. When receiving messages, last bit of the end-of-frame
|
1015 |
|
|
-- does not generate form error. Receiver goes to the idle mode one bit sooner.
|
1016 |
|
|
-- (CAN specification ver 2.0, part B, page 57).
|
1017 |
|
|
--
|
1018 |
|
|
-- Revision 1.13 2003/01/15 21:59:45 mohor
|
1019 |
|
|
-- Data is stored to fifo at the end of ack stage.
|
1020 |
|
|
--
|
1021 |
|
|
-- Revision 1.12 2003/01/15 21:05:11 mohor
|
1022 |
|
|
-- CRC checking fixed (when bitstuff occurs at the end of a CRC sequence).
|
1023 |
|
|
--
|
1024 |
|
|
-- Revision 1.11 2003/01/15 14:40:23 mohor
|
1025 |
|
|
-- RX state machine fixed to receive "remote request" frames correctly.
|
1026 |
|
|
-- No data bytes are written to fifo when such frames are received.
|
1027 |
|
|
--
|
1028 |
|
|
-- Revision 1.10 2003/01/15 13:16:47 mohor
|
1029 |
|
|
-- When a frame with "remote request" is received, no data is stored to
|
1030 |
|
|
-- fifo, just the frame information (identifier, ...). Data length that
|
1031 |
|
|
-- is stored is the received data length and not the actual data length
|
1032 |
|
|
-- that is stored to fifo.
|
1033 |
|
|
--
|
1034 |
|
|
-- Revision 1.9 2003/01/14 12:19:35 mohor
|
1035 |
|
|
-- rx_fifo is now working.
|
1036 |
|
|
--
|
1037 |
|
|
-- Revision 1.8 2003/01/10 17:51:33 mohor
|
1038 |
|
|
-- Temporary version (backup).
|
1039 |
|
|
--
|
1040 |
|
|
-- Revision 1.7 2003/01/09 21:54:45 mohor
|
1041 |
|
|
-- rx fifo added. Not 100 % verified, yet.
|
1042 |
|
|
--
|
1043 |
|
|
-- Revision 1.6 2003/01/09 14:46:58 mohor
|
1044 |
|
|
-- Temporary files (backup).
|
1045 |
|
|
--
|
1046 |
|
|
-- Revision 1.5 2003/01/08 13:30:31 mohor
|
1047 |
|
|
-- Temp version.
|
1048 |
|
|
--
|
1049 |
|
|
-- Revision 1.4 2003/01/08 02:10:53 mohor
|
1050 |
|
|
-- Acceptance filter added.
|
1051 |
|
|
--
|
1052 |
|
|
-- Revision 1.3 2002/12/28 04:13:23 mohor
|
1053 |
|
|
-- Backup version.
|
1054 |
|
|
--
|
1055 |
|
|
-- Revision 1.2 2002/12/27 00:12:52 mohor
|
1056 |
|
|
-- Header changed, testbench improved to send a frame (crc still missing).
|
1057 |
|
|
--
|
1058 |
|
|
-- Revision 1.1.1.1 2002/12/20 16:39:21 mohor
|
1059 |
|
|
-- Initial
|
1060 |
|
|
--
|
1061 |
|
|
--
|
1062 |
|
|
--
|
1063 |
|
|
-- synopsys translate_off
|
1064 |
|
|
--`include "can_defines.v"
|
1065 |
|
|
-- synopsys translate_on
|
1066 |
|
|
LIBRARY ieee;
|
1067 |
|
|
USE ieee.std_logic_1164.all;
|
1068 |
|
|
USE ieee.numeric_std.all;
|
1069 |
|
|
|
1070 |
|
|
library grlib;
|
1071 |
|
|
use grlib.stdlib.all;
|
1072 |
|
|
|
1073 |
|
|
ENTITY can_bsp_core_sync IS
|
1074 |
|
|
PORT (
|
1075 |
|
|
clk : IN std_logic;
|
1076 |
|
|
rst : IN std_logic;
|
1077 |
|
|
restart : in std_logic;
|
1078 |
|
|
sample_point : IN std_logic;
|
1079 |
|
|
sampled_bit : IN std_logic;
|
1080 |
|
|
sampled_bit_q : IN std_logic;
|
1081 |
|
|
tx_point : IN std_logic;
|
1082 |
|
|
hard_sync : IN std_logic;
|
1083 |
|
|
reset_mode : IN std_logic;
|
1084 |
|
|
listen_only_mode : IN std_logic;
|
1085 |
|
|
self_test_mode : IN std_logic;
|
1086 |
|
|
-- Command register
|
1087 |
|
|
tx_request : IN std_logic;
|
1088 |
|
|
abort_tx : IN std_logic;
|
1089 |
|
|
self_rx_request : IN std_logic;
|
1090 |
|
|
single_shot_transmission: IN std_logic;
|
1091 |
|
|
tx_state : OUT std_logic;
|
1092 |
|
|
tx_state_q : OUT std_logic;
|
1093 |
|
|
overload_request : IN std_logic; -- When receiver is busy, it needs to send overload frame. Only 2 overload frames are allowed to
|
1094 |
|
|
overload_frame : OUT std_logic; -- be send in a row. This is not implemented, yet, because host can not send an overload request.
|
1095 |
|
|
-- Arbitration Lost Capture Register
|
1096 |
|
|
read_arbitration_lost_capture_reg: IN std_logic;
|
1097 |
|
|
-- Error Code Capture Register
|
1098 |
|
|
read_error_code_capture_reg: IN std_logic;
|
1099 |
|
|
error_capture_code : OUT std_logic_vector(7 DOWNTO 0);
|
1100 |
|
|
-- Error Warning Limit register
|
1101 |
|
|
extended_mode : IN std_logic;
|
1102 |
|
|
rx_idle : OUT std_logic;
|
1103 |
|
|
transmitting : OUT std_logic;
|
1104 |
|
|
transmitter : OUT std_logic;
|
1105 |
|
|
go_rx_inter : OUT std_logic;
|
1106 |
|
|
not_first_bit_of_inter : OUT std_logic;
|
1107 |
|
|
rx_inter : OUT std_logic;
|
1108 |
|
|
node_bus_off : OUT std_logic;
|
1109 |
|
|
rx_err_cnt : OUT std_logic_vector(8 DOWNTO 0);
|
1110 |
|
|
tx_err_cnt : OUT std_logic_vector(8 DOWNTO 0);
|
1111 |
|
|
transmit_status : OUT std_logic;
|
1112 |
|
|
receive_status : OUT std_logic;
|
1113 |
|
|
tx_successful : OUT std_logic;
|
1114 |
|
|
need_to_tx : OUT std_logic;
|
1115 |
|
|
overrun : OUT std_logic;
|
1116 |
|
|
set_bus_error_irq : OUT std_logic;
|
1117 |
|
|
set_arbitration_lost_irq: OUT std_logic;
|
1118 |
|
|
arbitration_lost_capture: OUT std_logic_vector(4 DOWNTO 0);
|
1119 |
|
|
node_error_passive : OUT std_logic;
|
1120 |
|
|
node_error_active : OUT std_logic;
|
1121 |
|
|
|
1122 |
|
|
|
1123 |
|
|
tx_data_0 : IN std_logic_vector(7 DOWNTO 0);
|
1124 |
|
|
tx_data_1 : IN std_logic_vector(7 DOWNTO 0);
|
1125 |
|
|
tx_data_2 : IN std_logic_vector(7 DOWNTO 0);
|
1126 |
|
|
tx_data_3 : IN std_logic_vector(7 DOWNTO 0);
|
1127 |
|
|
tx_data_4 : IN std_logic_vector(7 DOWNTO 0);
|
1128 |
|
|
tx_data_5 : IN std_logic_vector(7 DOWNTO 0);
|
1129 |
|
|
tx_data_6 : IN std_logic_vector(7 DOWNTO 0);
|
1130 |
|
|
tx_data_7 : IN std_logic_vector(7 DOWNTO 0);
|
1131 |
|
|
tx_data_8 : IN std_logic_vector(7 DOWNTO 0);
|
1132 |
|
|
tx_data_9 : IN std_logic_vector(7 DOWNTO 0);
|
1133 |
|
|
tx_data_10 : IN std_logic_vector(7 DOWNTO 0);
|
1134 |
|
|
tx_data_11 : IN std_logic_vector(7 DOWNTO 0);
|
1135 |
|
|
tx_data_12 : IN std_logic_vector(7 DOWNTO 0);
|
1136 |
|
|
|
1137 |
|
|
rcv_msg_data : out std_logic_vector(63 downto 0);
|
1138 |
|
|
rcv_id : out std_logic_vector(28 downto 0);
|
1139 |
|
|
rcv_dlc : out std_logic_vector(3 downto 0);
|
1140 |
|
|
rcv_rtr : out std_logic;
|
1141 |
|
|
rcv_ide : out std_logic;
|
1142 |
|
|
rcv_msg_valid : out std_logic;
|
1143 |
|
|
|
1144 |
|
|
form_error : out std_logic;
|
1145 |
|
|
crc_error : out std_logic;
|
1146 |
|
|
ack_error : out std_logic;
|
1147 |
|
|
stuff_error : out std_logic;
|
1148 |
|
|
bit_error : out std_logic;
|
1149 |
|
|
arb_loss : out std_logic;
|
1150 |
|
|
|
1151 |
|
|
tx : OUT std_logic;
|
1152 |
|
|
tx_next : OUT std_logic;
|
1153 |
|
|
go_overload_frame : OUT std_logic;
|
1154 |
|
|
go_error_frame : OUT std_logic;
|
1155 |
|
|
go_tx : OUT std_logic;
|
1156 |
|
|
send_ack : OUT std_logic);
|
1157 |
|
|
END ENTITY can_bsp_core_sync;
|
1158 |
|
|
|
1159 |
|
|
ARCHITECTURE RTL OF can_bsp_core_sync IS
|
1160 |
|
|
|
1161 |
|
|
|
1162 |
|
|
COMPONENT can_crc_core_sync
|
1163 |
|
|
PORT (
|
1164 |
|
|
clk : IN std_logic;
|
1165 |
|
|
data : IN std_logic;
|
1166 |
|
|
enable : IN std_logic;
|
1167 |
|
|
initialize : IN std_logic;
|
1168 |
|
|
crc : OUT std_logic_vector(14 DOWNTO 0));
|
1169 |
|
|
END COMPONENT;
|
1170 |
|
|
|
1171 |
|
|
COMPONENT can_ibo_core_sync
|
1172 |
|
|
PORT (
|
1173 |
|
|
di : IN std_logic_vector(7 DOWNTO 0);
|
1174 |
|
|
do : OUT std_logic_vector(7 DOWNTO 0));
|
1175 |
|
|
END COMPONENT;
|
1176 |
|
|
|
1177 |
|
|
TYPE xhdl_46 IS ARRAY (0 TO 7) OF std_logic_vector(7 DOWNTO 0);
|
1178 |
|
|
|
1179 |
|
|
------------------------------
|
1180 |
|
|
|
1181 |
|
|
SIGNAL reset_mode_q : std_logic;
|
1182 |
|
|
SIGNAL bit_cnt : std_logic_vector(5 DOWNTO 0);
|
1183 |
|
|
SIGNAL data_len : std_logic_vector(3 DOWNTO 0);
|
1184 |
|
|
SIGNAL id : std_logic_vector(28 DOWNTO 0);
|
1185 |
|
|
SIGNAL bit_stuff_cnt : std_logic_vector(2 DOWNTO 0);
|
1186 |
|
|
SIGNAL bit_stuff_cnt_tx : std_logic_vector(2 DOWNTO 0);
|
1187 |
|
|
SIGNAL tx_point_q : std_logic;
|
1188 |
|
|
SIGNAL rx_id1 : std_logic;
|
1189 |
|
|
SIGNAL rx_rtr1 : std_logic;
|
1190 |
|
|
SIGNAL rx_ide : std_logic;
|
1191 |
|
|
SIGNAL rx_id2 : std_logic;
|
1192 |
|
|
SIGNAL rx_rtr2 : std_logic;
|
1193 |
|
|
SIGNAL rx_r1 : std_logic;
|
1194 |
|
|
SIGNAL rx_r0 : std_logic;
|
1195 |
|
|
SIGNAL rx_dlc : std_logic;
|
1196 |
|
|
SIGNAL rx_data : std_logic;
|
1197 |
|
|
SIGNAL rx_crc : std_logic;
|
1198 |
|
|
SIGNAL rx_crc_lim : std_logic;
|
1199 |
|
|
SIGNAL rx_ack : std_logic;
|
1200 |
|
|
SIGNAL rx_ack_lim : std_logic;
|
1201 |
|
|
SIGNAL rx_eof : std_logic;
|
1202 |
|
|
SIGNAL go_early_tx_latched : std_logic;
|
1203 |
|
|
SIGNAL rtr1 : std_logic;
|
1204 |
|
|
SIGNAL ide : std_logic;
|
1205 |
|
|
SIGNAL rtr2 : std_logic;
|
1206 |
|
|
SIGNAL crc_in : std_logic_vector(14 DOWNTO 0);
|
1207 |
|
|
SIGNAL tmp_data : std_logic_vector(7 DOWNTO 0);
|
1208 |
|
|
SIGNAL tmp_fifo : xhdl_46;
|
1209 |
|
|
SIGNAL write_data_to_tmp_fifo : std_logic;
|
1210 |
|
|
SIGNAL byte_cnt : std_logic_vector(2 DOWNTO 0);
|
1211 |
|
|
SIGNAL bit_stuff_cnt_en : std_logic;
|
1212 |
|
|
SIGNAL crc_enable : std_logic;
|
1213 |
|
|
SIGNAL eof_cnt : std_logic_vector(2 DOWNTO 0);
|
1214 |
|
|
SIGNAL passive_cnt : std_logic_vector(2 DOWNTO 0);
|
1215 |
|
|
SIGNAL error_frame : std_logic;
|
1216 |
|
|
SIGNAL enable_error_cnt2 : std_logic;
|
1217 |
|
|
SIGNAL error_cnt1 : std_logic_vector(2 DOWNTO 0);
|
1218 |
|
|
SIGNAL error_cnt2 : std_logic_vector(2 DOWNTO 0);
|
1219 |
|
|
SIGNAL delayed_dominant_cnt : std_logic_vector(2 DOWNTO 0);
|
1220 |
|
|
SIGNAL enable_overload_cnt2 : std_logic;
|
1221 |
|
|
SIGNAL overload_frame_blocked : std_logic;
|
1222 |
|
|
SIGNAL overload_request_cnt : std_logic_vector(1 DOWNTO 0);
|
1223 |
|
|
SIGNAL overload_cnt1 : std_logic_vector(2 DOWNTO 0);
|
1224 |
|
|
SIGNAL overload_cnt2 : std_logic_vector(2 DOWNTO 0);
|
1225 |
|
|
SIGNAL crc_err : std_logic;
|
1226 |
|
|
SIGNAL arbitration_lost : std_logic;
|
1227 |
|
|
SIGNAL arbitration_lost_q : std_logic;
|
1228 |
|
|
SIGNAL read_arbitration_lost_capture_reg_q: std_logic;
|
1229 |
|
|
signal read_error_code_capture_reg_q : std_logic;
|
1230 |
|
|
signal reset_error_code_capture_reg : std_logic;
|
1231 |
|
|
SIGNAL arbitration_cnt_en : std_logic;
|
1232 |
|
|
SIGNAL arbitration_blocked : std_logic;
|
1233 |
|
|
SIGNAL tx_q : std_logic;
|
1234 |
|
|
SIGNAL data_cnt : std_logic_vector(3 DOWNTO 0); -- Counting the data bytes that are written to FIFO
|
1235 |
|
|
SIGNAL header_cnt : std_logic_vector(2 DOWNTO 0); -- Counting header length
|
1236 |
|
|
SIGNAL wr_fifo : std_logic; -- Write data and header to 64-byte fifo
|
1237 |
|
|
SIGNAL wr_fifo2 : std_logic;
|
1238 |
|
|
SIGNAL data_for_fifo : std_logic_vector(7 DOWNTO 0); -- Multiplexed data that is stored to 64-byte fifo
|
1239 |
|
|
SIGNAL tx_pointer : std_logic_vector(5 DOWNTO 0);
|
1240 |
|
|
SIGNAL tx_bit : std_logic;
|
1241 |
|
|
SIGNAL finish_msg : std_logic;
|
1242 |
|
|
SIGNAL bus_free_cnt : std_logic_vector(3 DOWNTO 0);
|
1243 |
|
|
SIGNAL bus_free_cnt_en : std_logic;
|
1244 |
|
|
SIGNAL bus_free : std_logic;
|
1245 |
|
|
SIGNAL waiting_for_bus_free : std_logic;
|
1246 |
|
|
SIGNAL node_bus_off_q : std_logic;
|
1247 |
|
|
SIGNAL ack_err_latched : std_logic;
|
1248 |
|
|
SIGNAL bit_err_latched : std_logic;
|
1249 |
|
|
SIGNAL stuff_err_latched : std_logic;
|
1250 |
|
|
SIGNAL form_err_latched : std_logic;
|
1251 |
|
|
SIGNAL rule3_exc1_1 : std_logic;
|
1252 |
|
|
SIGNAL rule3_exc1_2 : std_logic;
|
1253 |
|
|
SIGNAL suspend : std_logic;
|
1254 |
|
|
SIGNAL susp_cnt_en : std_logic;
|
1255 |
|
|
SIGNAL susp_cnt : std_logic_vector(2 DOWNTO 0);
|
1256 |
|
|
SIGNAL error_flag_over_latched : std_logic;
|
1257 |
|
|
SIGNAL error_capture_code_type : std_logic_vector(7 DOWNTO 6);
|
1258 |
|
|
SIGNAL error_capture_code_blocked : std_logic;
|
1259 |
|
|
SIGNAL first_compare_bit : std_logic;
|
1260 |
|
|
SIGNAL error_capture_code_segment : std_logic_vector(4 DOWNTO 0);
|
1261 |
|
|
SIGNAL error_capture_code_direction : std_logic;
|
1262 |
|
|
SIGNAL bit_de_stuff : std_logic;
|
1263 |
|
|
SIGNAL bit_de_stuff_tx : std_logic;
|
1264 |
|
|
SIGNAL rule5 : std_logic;
|
1265 |
|
|
-- Rx state machine
|
1266 |
|
|
SIGNAL go_rx_idle : std_logic;
|
1267 |
|
|
SIGNAL go_rx_id1 : std_logic;
|
1268 |
|
|
SIGNAL go_rx_rtr1 : std_logic;
|
1269 |
|
|
SIGNAL go_rx_ide : std_logic;
|
1270 |
|
|
SIGNAL go_rx_id2 : std_logic;
|
1271 |
|
|
SIGNAL go_rx_rtr2 : std_logic;
|
1272 |
|
|
SIGNAL go_rx_r1 : std_logic;
|
1273 |
|
|
SIGNAL go_rx_r0 : std_logic;
|
1274 |
|
|
SIGNAL go_rx_dlc : std_logic;
|
1275 |
|
|
SIGNAL go_rx_data : std_logic;
|
1276 |
|
|
SIGNAL go_rx_crc : std_logic;
|
1277 |
|
|
SIGNAL go_rx_crc_lim : std_logic;
|
1278 |
|
|
SIGNAL go_rx_ack : std_logic;
|
1279 |
|
|
SIGNAL go_rx_ack_lim : std_logic;
|
1280 |
|
|
SIGNAL go_rx_eof : std_logic;
|
1281 |
|
|
SIGNAL last_bit_of_inter : std_logic;
|
1282 |
|
|
SIGNAL go_crc_enable : std_logic;
|
1283 |
|
|
SIGNAL rst_crc_enable : std_logic;
|
1284 |
|
|
SIGNAL bit_de_stuff_set : std_logic;
|
1285 |
|
|
SIGNAL bit_de_stuff_reset : std_logic;
|
1286 |
|
|
SIGNAL go_early_tx : std_logic;
|
1287 |
|
|
SIGNAL calculated_crc : std_logic_vector(14 DOWNTO 0);
|
1288 |
|
|
SIGNAL r_calculated_crc : std_logic_vector(15 DOWNTO 0);
|
1289 |
|
|
SIGNAL remote_rq : std_logic;
|
1290 |
|
|
SIGNAL limited_data_len : std_logic_vector(3 DOWNTO 0);
|
1291 |
|
|
SIGNAL form_err : std_logic;
|
1292 |
|
|
SIGNAL error_frame_ended : std_logic;
|
1293 |
|
|
SIGNAL overload_frame_ended : std_logic;
|
1294 |
|
|
SIGNAL bit_err : std_logic;
|
1295 |
|
|
SIGNAL ack_err : std_logic;
|
1296 |
|
|
SIGNAL stuff_err : std_logic;
|
1297 |
|
|
SIGNAL id_ok : std_logic; -- If received ID matches ID set in registers
|
1298 |
|
|
SIGNAL no_byte0 : std_logic; -- There is no byte 0 (RTR bit set to 1 or DLC field equal to 0). Signal used for acceptance filter.
|
1299 |
|
|
SIGNAL no_byte1 : std_logic; -- There is no byte 1 (RTR bit set to 1 or DLC field equal to 1). Signal used for acceptance filter.
|
1300 |
|
|
SIGNAL header_len : std_logic_vector(2 DOWNTO 0);
|
1301 |
|
|
SIGNAL storing_header : std_logic;
|
1302 |
|
|
SIGNAL limited_data_len_minus1 : std_logic_vector(3 DOWNTO 0);
|
1303 |
|
|
SIGNAL reset_wr_fifo : std_logic;
|
1304 |
|
|
SIGNAL err : std_logic;
|
1305 |
|
|
SIGNAL arbitration_field : std_logic;
|
1306 |
|
|
SIGNAL basic_chain : std_logic_vector(18 DOWNTO 0);
|
1307 |
|
|
SIGNAL basic_chain_data : std_logic_vector(63 DOWNTO 0);
|
1308 |
|
|
SIGNAL extended_chain_std : std_logic_vector(18 DOWNTO 0);
|
1309 |
|
|
SIGNAL extended_chain_ext : std_logic_vector(38 DOWNTO 0);
|
1310 |
|
|
SIGNAL extended_chain_data_std : std_logic_vector(63 DOWNTO 0);
|
1311 |
|
|
SIGNAL extended_chain_data_ext : std_logic_vector(63 DOWNTO 0);
|
1312 |
|
|
SIGNAL rst_tx_pointer : std_logic;
|
1313 |
|
|
SIGNAL r_tx_data_0 : std_logic_vector(7 DOWNTO 0);
|
1314 |
|
|
SIGNAL r_tx_data_1 : std_logic_vector(7 DOWNTO 0);
|
1315 |
|
|
SIGNAL r_tx_data_2 : std_logic_vector(7 DOWNTO 0);
|
1316 |
|
|
SIGNAL r_tx_data_3 : std_logic_vector(7 DOWNTO 0);
|
1317 |
|
|
SIGNAL r_tx_data_4 : std_logic_vector(7 DOWNTO 0);
|
1318 |
|
|
SIGNAL r_tx_data_5 : std_logic_vector(7 DOWNTO 0);
|
1319 |
|
|
SIGNAL r_tx_data_6 : std_logic_vector(7 DOWNTO 0);
|
1320 |
|
|
SIGNAL r_tx_data_7 : std_logic_vector(7 DOWNTO 0);
|
1321 |
|
|
SIGNAL r_tx_data_8 : std_logic_vector(7 DOWNTO 0);
|
1322 |
|
|
SIGNAL r_tx_data_9 : std_logic_vector(7 DOWNTO 0);
|
1323 |
|
|
SIGNAL r_tx_data_10 : std_logic_vector(7 DOWNTO 0);
|
1324 |
|
|
SIGNAL r_tx_data_11 : std_logic_vector(7 DOWNTO 0);
|
1325 |
|
|
SIGNAL r_tx_data_12 : std_logic_vector(7 DOWNTO 0);
|
1326 |
|
|
SIGNAL bit_err_exc1 : std_logic;
|
1327 |
|
|
SIGNAL bit_err_exc2 : std_logic;
|
1328 |
|
|
SIGNAL bit_err_exc3 : std_logic;
|
1329 |
|
|
SIGNAL bit_err_exc4 : std_logic;
|
1330 |
|
|
SIGNAL bit_err_exc5 : std_logic;
|
1331 |
|
|
SIGNAL bit_err_exc6 : std_logic;
|
1332 |
|
|
SIGNAL error_flag_over : std_logic;
|
1333 |
|
|
SIGNAL overload_flag_over : std_logic;
|
1334 |
|
|
SIGNAL limited_tx_cnt_ext : std_logic_vector(5 DOWNTO 0);
|
1335 |
|
|
SIGNAL limited_tx_cnt_std : std_logic_vector(5 DOWNTO 0);
|
1336 |
|
|
|
1337 |
|
|
-- Instantiation of the RX CRC module
|
1338 |
|
|
SIGNAL xhdl_49 : std_logic;
|
1339 |
|
|
-- Mode register
|
1340 |
|
|
-- Clock Divider register
|
1341 |
|
|
-- This section is for BASIC and EXTENDED mode
|
1342 |
|
|
-- Acceptance code register
|
1343 |
|
|
-- Acceptance mask register
|
1344 |
|
|
-- End: This section is for BASIC and EXTENDED mode
|
1345 |
|
|
-- This section is for EXTENDED mode
|
1346 |
|
|
-- Acceptance code register
|
1347 |
|
|
-- Acceptance mask register
|
1348 |
|
|
-- End: This section is for EXTENDED mode
|
1349 |
|
|
|
1350 |
|
|
SIGNAL temp_xhdl47 : std_logic_vector(3 DOWNTO 0);
|
1351 |
|
|
SIGNAL port_xhdl73 : std_logic_vector(7 DOWNTO 0);
|
1352 |
|
|
SIGNAL port_xhdl74 : std_logic_vector(7 DOWNTO 0);
|
1353 |
|
|
SIGNAL temp_xhdl75 : std_logic_vector(2 DOWNTO 0);
|
1354 |
|
|
SIGNAL temp_xhdl76 : std_logic_vector(2 DOWNTO 0);
|
1355 |
|
|
SIGNAL temp_xhdl77 : std_logic_vector(3 DOWNTO 0);
|
1356 |
|
|
SIGNAL temp_xhdl78 : std_logic_vector(3 DOWNTO 0); -- - 1 because counter counts from 0
|
1357 |
|
|
SIGNAL xhdl_106 : std_logic_vector(7 DOWNTO 0);
|
1358 |
|
|
SIGNAL temp_xhdl108 : std_logic_vector(5 DOWNTO 0);
|
1359 |
|
|
SIGNAL temp_xhdl109 : std_logic_vector(5 DOWNTO 0);
|
1360 |
|
|
SIGNAL temp_xhdl110 : boolean;
|
1361 |
|
|
SIGNAL temp_xhdl111 : std_logic;
|
1362 |
|
|
SIGNAL tx_state_xhdl2 : std_logic;
|
1363 |
|
|
SIGNAL tx_state_q_xhdl3 : std_logic;
|
1364 |
|
|
SIGNAL overload_frame_xhdl4 : std_logic;
|
1365 |
|
|
SIGNAL error_capture_code_xhdl5 : std_logic_vector(7 DOWNTO 0);
|
1366 |
|
|
SIGNAL rx_idle_xhdl6 : std_logic;
|
1367 |
|
|
SIGNAL transmitting_xhdl7 : std_logic;
|
1368 |
|
|
SIGNAL transmitter_xhdl8 : std_logic;
|
1369 |
|
|
SIGNAL go_rx_inter_xhdl9 : std_logic;
|
1370 |
|
|
SIGNAL not_first_bit_of_inter_xhdl10 : std_logic;
|
1371 |
|
|
SIGNAL rx_inter_xhdl11 : std_logic;
|
1372 |
|
|
SIGNAL node_bus_off_xhdl13 : std_logic;
|
1373 |
|
|
SIGNAL rx_err_cnt_xhdl15 : std_logic_vector(8 DOWNTO 0);
|
1374 |
|
|
SIGNAL tx_err_cnt_xhdl16 : std_logic_vector(8 DOWNTO 0);
|
1375 |
|
|
SIGNAL transmit_status_xhdl17 : std_logic;
|
1376 |
|
|
SIGNAL receive_status_xhdl18 : std_logic;
|
1377 |
|
|
SIGNAL tx_successful_xhdl19 : std_logic;
|
1378 |
|
|
SIGNAL need_to_tx_xhdl20 : std_logic;
|
1379 |
|
|
SIGNAL overrun_xhdl21 : std_logic;
|
1380 |
|
|
SIGNAL set_bus_error_irq_xhdl23 : std_logic;
|
1381 |
|
|
SIGNAL set_arbitration_lost_irq_xhdl24 : std_logic;
|
1382 |
|
|
SIGNAL arbitration_lost_capture_xhdl25 : std_logic_vector(4 DOWNTO 0);
|
1383 |
|
|
SIGNAL node_error_passive_xhdl26: std_logic;
|
1384 |
|
|
SIGNAL node_error_active_xhdl27 : std_logic;
|
1385 |
|
|
SIGNAL tx_xhdl29 : std_logic;
|
1386 |
|
|
SIGNAL tx_next_xhdl30 : std_logic;
|
1387 |
|
|
SIGNAL go_overload_frame_xhdl32 : std_logic;
|
1388 |
|
|
SIGNAL go_error_frame_xhdl33 : std_logic;
|
1389 |
|
|
SIGNAL go_tx_xhdl34 : std_logic;
|
1390 |
|
|
SIGNAL send_ack_xhdl35 : std_logic;
|
1391 |
|
|
|
1392 |
|
|
signal rx_msg_data : std_logic_vector(63 downto 0);
|
1393 |
|
|
|
1394 |
|
|
SIGNAL set_reset_mode_xhdl12 : std_logic;
|
1395 |
|
|
|
1396 |
|
|
BEGIN
|
1397 |
|
|
|
1398 |
|
|
|
1399 |
|
|
form_error <= form_err_latched;
|
1400 |
|
|
crc_error <= crc_err;
|
1401 |
|
|
ack_error <= ack_err_latched;
|
1402 |
|
|
stuff_error <= stuff_err_latched;
|
1403 |
|
|
bit_error <= bit_err_latched;
|
1404 |
|
|
arb_loss <= arbitration_lost;
|
1405 |
|
|
|
1406 |
|
|
tx_state <= tx_state_xhdl2;
|
1407 |
|
|
tx_state_q <= tx_state_q_xhdl3;
|
1408 |
|
|
overload_frame <= overload_frame_xhdl4;
|
1409 |
|
|
error_capture_code <= error_capture_code_xhdl5;
|
1410 |
|
|
rx_idle <= rx_idle_xhdl6;
|
1411 |
|
|
transmitting <= transmitting_xhdl7;
|
1412 |
|
|
transmitter <= transmitter_xhdl8;
|
1413 |
|
|
go_rx_inter <= go_rx_inter_xhdl9;
|
1414 |
|
|
not_first_bit_of_inter <= not_first_bit_of_inter_xhdl10;
|
1415 |
|
|
rx_inter <= rx_inter_xhdl11;
|
1416 |
|
|
node_bus_off <= node_bus_off_xhdl13;
|
1417 |
|
|
rx_err_cnt <= rx_err_cnt_xhdl15;
|
1418 |
|
|
tx_err_cnt <= tx_err_cnt_xhdl16;
|
1419 |
|
|
transmit_status <= transmitter_xhdl8;
|
1420 |
|
|
-- transmit_status <= transmit_status_xhdl17;
|
1421 |
|
|
receive_status <= receive_status_xhdl18;
|
1422 |
|
|
tx_successful <= tx_successful_xhdl19;
|
1423 |
|
|
need_to_tx <= need_to_tx_xhdl20;
|
1424 |
|
|
overrun <= overrun_xhdl21;
|
1425 |
|
|
set_bus_error_irq <= set_bus_error_irq_xhdl23;
|
1426 |
|
|
set_arbitration_lost_irq <= set_arbitration_lost_irq_xhdl24;
|
1427 |
|
|
arbitration_lost_capture <= arbitration_lost_capture_xhdl25;
|
1428 |
|
|
node_error_passive <= node_error_passive_xhdl26;
|
1429 |
|
|
node_error_active <= node_error_active_xhdl27;
|
1430 |
|
|
tx <= tx_xhdl29;
|
1431 |
|
|
tx_next <= tx_next_xhdl30;
|
1432 |
|
|
go_overload_frame <= go_overload_frame_xhdl32;
|
1433 |
|
|
go_error_frame <= go_error_frame_xhdl33;
|
1434 |
|
|
go_tx <= go_tx_xhdl34;
|
1435 |
|
|
send_ack <= send_ack_xhdl35;
|
1436 |
|
|
|
1437 |
|
|
go_rx_idle <= ((sample_point AND sampled_bit) AND last_bit_of_inter) OR (bus_free AND (NOT node_bus_off_xhdl13)) ;
|
1438 |
|
|
go_rx_id1 <= (sample_point AND (NOT sampled_bit)) AND (rx_idle_xhdl6 OR last_bit_of_inter) ;
|
1439 |
|
|
go_rx_rtr1 <= (((NOT bit_de_stuff) AND sample_point) AND rx_id1) AND CONV_STD_LOGIC(bit_cnt(3 DOWNTO 0) = "1010") ;
|
1440 |
|
|
go_rx_ide <= ((NOT bit_de_stuff) AND sample_point) AND rx_rtr1 ;
|
1441 |
|
|
go_rx_id2 <= (((NOT bit_de_stuff) AND sample_point) AND rx_ide) AND sampled_bit ;
|
1442 |
|
|
go_rx_rtr2 <= (((NOT bit_de_stuff) AND sample_point) AND rx_id2) AND CONV_STD_LOGIC(bit_cnt(4 DOWNTO 0) = "10001") ;
|
1443 |
|
|
go_rx_r1 <= ((NOT bit_de_stuff) AND sample_point) AND rx_rtr2 ;
|
1444 |
|
|
go_rx_r0 <= ((NOT bit_de_stuff) AND sample_point) AND ((rx_ide AND (NOT sampled_bit)) OR rx_r1) ;
|
1445 |
|
|
go_rx_dlc <= ((NOT bit_de_stuff) AND sample_point) AND rx_r0 ;
|
1446 |
|
|
go_rx_data <= (((((NOT bit_de_stuff) AND sample_point) AND rx_dlc) AND CONV_STD_LOGIC(bit_cnt(1 DOWNTO 0) = "11")) AND (sampled_bit OR (orv(data_len(2 DOWNTO 0))))) AND (NOT remote_rq) ;
|
1447 |
|
|
go_rx_crc <= ((NOT bit_de_stuff) AND sample_point) AND (((rx_dlc AND CONV_STD_LOGIC(bit_cnt(1 DOWNTO 0) = "11")) AND (((NOT sampled_bit) AND (NOT (orv(data_len(2 DOWNTO 0))))) OR remote_rq)) OR (rx_data AND CONV_STD_LOGIC('0' & bit_cnt(5 DOWNTO 0) = ((limited_data_len & "000") - 1)))) ;
|
1448 |
|
|
go_rx_crc_lim <= (((NOT bit_de_stuff) AND sample_point) AND rx_crc) AND CONV_STD_LOGIC(bit_cnt(3 DOWNTO 0) = "1110") ;
|
1449 |
|
|
go_rx_ack <= ((NOT bit_de_stuff) AND sample_point) AND rx_crc_lim ;
|
1450 |
|
|
go_rx_ack_lim <= sample_point AND rx_ack ;
|
1451 |
|
|
go_rx_eof <= sample_point AND rx_ack_lim ;
|
1452 |
|
|
go_rx_inter_xhdl9 <= (((sample_point AND rx_eof) AND CONV_STD_LOGIC(eof_cnt = "110")) OR error_frame_ended OR overload_frame_ended) AND (NOT overload_request) ;
|
1453 |
|
|
go_error_frame_xhdl33 <= form_err OR stuff_err OR bit_err OR ack_err OR (crc_err AND go_rx_eof) ;
|
1454 |
|
|
error_frame_ended <= CONV_STD_LOGIC(error_cnt2 = "111") AND tx_point ;
|
1455 |
|
|
overload_frame_ended <= CONV_STD_LOGIC(overload_cnt2 = "111") AND tx_point ;
|
1456 |
|
|
go_overload_frame_xhdl32 <= (((sample_point AND ((NOT sampled_bit) OR overload_request)) AND (((rx_eof AND (NOT transmitter_xhdl8)) AND CONV_STD_LOGIC(eof_cnt = "110")) OR error_frame_ended OR overload_frame_ended)) OR (((sample_point AND (NOT sampled_bit)) AND rx_inter_xhdl11) AND CONV_STD_LOGIC(bit_cnt(1 DOWNTO 0) < "10")) OR ((sample_point AND (NOT sampled_bit)) AND CONV_STD_LOGIC((error_cnt2 = "111") OR (overload_cnt2 = "111")))) AND (NOT overload_frame_blocked) ;
|
1457 |
|
|
go_crc_enable <= hard_sync OR go_tx_xhdl34 ;
|
1458 |
|
|
rst_crc_enable <= go_rx_crc ;
|
1459 |
|
|
bit_de_stuff_set <= go_rx_id1 AND (NOT go_error_frame_xhdl33) ;
|
1460 |
|
|
bit_de_stuff_reset <= go_rx_ack OR reset_mode OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32 ;
|
1461 |
|
|
remote_rq <= ((NOT ide) AND rtr1) OR (ide AND rtr2) ;
|
1462 |
|
|
temp_xhdl47 <= data_len WHEN (data_len < "1000") ELSE "1000";
|
1463 |
|
|
limited_data_len <= temp_xhdl47 ;
|
1464 |
|
|
ack_err <= (((rx_ack AND sample_point) AND sampled_bit) AND tx_state_xhdl2) AND (NOT self_test_mode) ;
|
1465 |
|
|
bit_err <= ((((((((tx_state_xhdl2 OR error_frame OR overload_frame_xhdl4 OR rx_ack) AND sample_point) AND CONV_STD_LOGIC(tx_xhdl29 /= sampled_bit)) AND (NOT bit_err_exc1)) AND (NOT bit_err_exc2)) AND (NOT bit_err_exc3)) AND (NOT bit_err_exc4)) AND (NOT bit_err_exc5)) AND (NOT bit_err_exc6) ;
|
1466 |
|
|
bit_err_exc1 <= (tx_state_xhdl2 AND arbitration_field) AND tx_xhdl29 ;
|
1467 |
|
|
bit_err_exc2 <= rx_ack AND tx_xhdl29 ;
|
1468 |
|
|
bit_err_exc3 <= (error_frame AND node_error_passive_xhdl26) AND CONV_STD_LOGIC(error_cnt1 < "111") ;
|
1469 |
|
|
bit_err_exc4 <= ((error_frame AND CONV_STD_LOGIC(error_cnt1 = "111")) AND (NOT enable_error_cnt2)) OR ((overload_frame_xhdl4 AND CONV_STD_LOGIC(overload_cnt1 = "111")) AND (NOT enable_overload_cnt2)) ;
|
1470 |
|
|
bit_err_exc5 <= (error_frame AND CONV_STD_LOGIC(error_cnt2 = "111")) OR (overload_frame_xhdl4 AND CONV_STD_LOGIC(overload_cnt2 = "111")) ;
|
1471 |
|
|
bit_err_exc6 <= (CONV_STD_LOGIC(eof_cnt = "110") AND rx_eof) AND (NOT transmitter_xhdl8) ;
|
1472 |
|
|
arbitration_field <= rx_id1 OR rx_rtr1 OR rx_ide OR rx_id2 OR rx_rtr2 ;
|
1473 |
|
|
last_bit_of_inter <= rx_inter_xhdl11 AND CONV_STD_LOGIC(bit_cnt(1 DOWNTO 0) = "10") ;
|
1474 |
|
|
not_first_bit_of_inter_xhdl10 <= rx_inter_xhdl11 AND CONV_STD_LOGIC(bit_cnt(1 DOWNTO 0) /= "00") ;
|
1475 |
|
|
|
1476 |
|
|
-- Rx idle state
|
1477 |
|
|
|
1478 |
|
|
PROCESS (clk, rst)
|
1479 |
|
|
BEGIN
|
1480 |
|
|
-- IF (rst = '1') THEN
|
1481 |
|
|
-- rx_idle_xhdl6 <= '0';
|
1482 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1483 |
|
|
IF ((reset_mode OR go_rx_id1 OR go_error_frame_xhdl33) = '1') THEN
|
1484 |
|
|
rx_idle_xhdl6 <= '0' ;
|
1485 |
|
|
ELSE
|
1486 |
|
|
IF (go_rx_idle = '1') THEN
|
1487 |
|
|
rx_idle_xhdl6 <= '1' ;
|
1488 |
|
|
END IF;
|
1489 |
|
|
END IF;
|
1490 |
|
|
IF (rst = '1') THEN
|
1491 |
|
|
rx_idle_xhdl6 <= '0';
|
1492 |
|
|
END IF;
|
1493 |
|
|
END IF;
|
1494 |
|
|
END PROCESS;
|
1495 |
|
|
|
1496 |
|
|
-- Rx id1 state
|
1497 |
|
|
|
1498 |
|
|
PROCESS (clk, rst)
|
1499 |
|
|
BEGIN
|
1500 |
|
|
-- IF (rst = '1') THEN
|
1501 |
|
|
-- rx_id1 <= '0';
|
1502 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1503 |
|
|
IF ((reset_mode OR go_rx_rtr1 OR go_error_frame_xhdl33) = '1') THEN
|
1504 |
|
|
rx_id1 <= '0' ;
|
1505 |
|
|
ELSE
|
1506 |
|
|
IF (go_rx_id1 = '1') THEN
|
1507 |
|
|
rx_id1 <= '1' ;
|
1508 |
|
|
END IF;
|
1509 |
|
|
END IF;
|
1510 |
|
|
IF (rst = '1') THEN
|
1511 |
|
|
rx_id1 <= '0';
|
1512 |
|
|
END IF;
|
1513 |
|
|
END IF;
|
1514 |
|
|
END PROCESS;
|
1515 |
|
|
|
1516 |
|
|
-- Rx rtr1 state
|
1517 |
|
|
|
1518 |
|
|
PROCESS (clk, rst)
|
1519 |
|
|
BEGIN
|
1520 |
|
|
-- IF (rst = '1') THEN
|
1521 |
|
|
-- rx_rtr1 <= '0';
|
1522 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1523 |
|
|
IF ((reset_mode OR go_rx_ide OR go_error_frame_xhdl33) = '1') THEN
|
1524 |
|
|
rx_rtr1 <= '0' ;
|
1525 |
|
|
ELSE
|
1526 |
|
|
IF (go_rx_rtr1 = '1') THEN
|
1527 |
|
|
rx_rtr1 <= '1' ;
|
1528 |
|
|
END IF;
|
1529 |
|
|
END IF;
|
1530 |
|
|
IF (rst = '1') THEN
|
1531 |
|
|
rx_rtr1 <= '0';
|
1532 |
|
|
END IF;
|
1533 |
|
|
END IF;
|
1534 |
|
|
END PROCESS;
|
1535 |
|
|
|
1536 |
|
|
-- Rx ide state
|
1537 |
|
|
|
1538 |
|
|
PROCESS (clk, rst)
|
1539 |
|
|
BEGIN
|
1540 |
|
|
-- IF (rst = '1') THEN
|
1541 |
|
|
-- rx_ide <= '0';
|
1542 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1543 |
|
|
IF ((reset_mode OR go_rx_r0 OR go_rx_id2 OR go_error_frame_xhdl33) = '1') THEN
|
1544 |
|
|
rx_ide <= '0' ;
|
1545 |
|
|
ELSE
|
1546 |
|
|
IF (go_rx_ide = '1') THEN
|
1547 |
|
|
rx_ide <= '1' ;
|
1548 |
|
|
END IF;
|
1549 |
|
|
END IF;
|
1550 |
|
|
IF (rst = '1') THEN
|
1551 |
|
|
rx_ide <= '0';
|
1552 |
|
|
END IF;
|
1553 |
|
|
END IF;
|
1554 |
|
|
END PROCESS;
|
1555 |
|
|
|
1556 |
|
|
-- Rx id2 state
|
1557 |
|
|
|
1558 |
|
|
PROCESS (clk, rst)
|
1559 |
|
|
BEGIN
|
1560 |
|
|
-- IF (rst = '1') THEN
|
1561 |
|
|
-- rx_id2 <= '0';
|
1562 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1563 |
|
|
IF ((reset_mode OR go_rx_rtr2 OR go_error_frame_xhdl33) = '1') THEN
|
1564 |
|
|
rx_id2 <= '0' ;
|
1565 |
|
|
ELSE
|
1566 |
|
|
IF (go_rx_id2 = '1') THEN
|
1567 |
|
|
rx_id2 <= '1' ;
|
1568 |
|
|
END IF;
|
1569 |
|
|
END IF;
|
1570 |
|
|
IF (rst = '1') THEN
|
1571 |
|
|
rx_id2 <= '0';
|
1572 |
|
|
END IF;
|
1573 |
|
|
END IF;
|
1574 |
|
|
END PROCESS;
|
1575 |
|
|
|
1576 |
|
|
-- Rx rtr2 state
|
1577 |
|
|
|
1578 |
|
|
PROCESS (clk, rst)
|
1579 |
|
|
BEGIN
|
1580 |
|
|
-- IF (rst = '1') THEN
|
1581 |
|
|
-- rx_rtr2 <= '0';
|
1582 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1583 |
|
|
IF ((reset_mode OR go_rx_r1 OR go_error_frame_xhdl33) = '1') THEN
|
1584 |
|
|
rx_rtr2 <= '0' ;
|
1585 |
|
|
ELSE
|
1586 |
|
|
IF (go_rx_rtr2 = '1') THEN
|
1587 |
|
|
rx_rtr2 <= '1' ;
|
1588 |
|
|
END IF;
|
1589 |
|
|
END IF;
|
1590 |
|
|
IF (rst = '1') THEN
|
1591 |
|
|
rx_rtr2 <= '0';
|
1592 |
|
|
END IF;
|
1593 |
|
|
END IF;
|
1594 |
|
|
END PROCESS;
|
1595 |
|
|
|
1596 |
|
|
-- Rx r0 state
|
1597 |
|
|
|
1598 |
|
|
PROCESS (clk, rst)
|
1599 |
|
|
BEGIN
|
1600 |
|
|
-- IF (rst = '1') THEN
|
1601 |
|
|
-- rx_r1 <= '0';
|
1602 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1603 |
|
|
IF ((reset_mode OR go_rx_r0 OR go_error_frame_xhdl33) = '1') THEN
|
1604 |
|
|
rx_r1 <= '0' ;
|
1605 |
|
|
ELSE
|
1606 |
|
|
IF (go_rx_r1 = '1') THEN
|
1607 |
|
|
rx_r1 <= '1' ;
|
1608 |
|
|
END IF;
|
1609 |
|
|
END IF;
|
1610 |
|
|
IF (rst = '1') THEN
|
1611 |
|
|
rx_r1 <= '0';
|
1612 |
|
|
END IF;
|
1613 |
|
|
END IF;
|
1614 |
|
|
END PROCESS;
|
1615 |
|
|
|
1616 |
|
|
-- Rx r0 state
|
1617 |
|
|
|
1618 |
|
|
PROCESS (clk, rst)
|
1619 |
|
|
BEGIN
|
1620 |
|
|
-- IF (rst = '1') THEN
|
1621 |
|
|
-- rx_r0 <= '0';
|
1622 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1623 |
|
|
IF ((reset_mode OR go_rx_dlc OR go_error_frame_xhdl33) = '1') THEN
|
1624 |
|
|
rx_r0 <= '0' ;
|
1625 |
|
|
ELSE
|
1626 |
|
|
IF (go_rx_r0 = '1') THEN
|
1627 |
|
|
rx_r0 <= '1' ;
|
1628 |
|
|
END IF;
|
1629 |
|
|
END IF;
|
1630 |
|
|
IF (rst = '1') THEN
|
1631 |
|
|
rx_r0 <= '0';
|
1632 |
|
|
END IF;
|
1633 |
|
|
END IF;
|
1634 |
|
|
END PROCESS;
|
1635 |
|
|
|
1636 |
|
|
-- Rx dlc state
|
1637 |
|
|
|
1638 |
|
|
PROCESS (clk, rst)
|
1639 |
|
|
BEGIN
|
1640 |
|
|
-- IF (rst = '1') THEN
|
1641 |
|
|
-- rx_dlc <= '0';
|
1642 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1643 |
|
|
IF ((reset_mode OR go_rx_data OR go_rx_crc OR go_error_frame_xhdl33) = '1') THEN
|
1644 |
|
|
rx_dlc <= '0' ;
|
1645 |
|
|
ELSE
|
1646 |
|
|
IF (go_rx_dlc = '1') THEN
|
1647 |
|
|
rx_dlc <= '1' ;
|
1648 |
|
|
END IF;
|
1649 |
|
|
END IF;
|
1650 |
|
|
IF (rst = '1') THEN
|
1651 |
|
|
rx_dlc <= '0';
|
1652 |
|
|
END IF;
|
1653 |
|
|
END IF;
|
1654 |
|
|
END PROCESS;
|
1655 |
|
|
|
1656 |
|
|
-- Rx data state
|
1657 |
|
|
|
1658 |
|
|
PROCESS (clk, rst)
|
1659 |
|
|
BEGIN
|
1660 |
|
|
-- IF (rst = '1') THEN
|
1661 |
|
|
-- rx_data <= '0';
|
1662 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1663 |
|
|
IF ((reset_mode OR go_rx_crc OR go_error_frame_xhdl33) = '1') THEN
|
1664 |
|
|
rx_data <= '0' ;
|
1665 |
|
|
ELSE
|
1666 |
|
|
IF (go_rx_data = '1') THEN
|
1667 |
|
|
rx_data <= '1' ;
|
1668 |
|
|
END IF;
|
1669 |
|
|
END IF;
|
1670 |
|
|
IF (rst = '1') THEN
|
1671 |
|
|
rx_data <= '0';
|
1672 |
|
|
END IF;
|
1673 |
|
|
END IF;
|
1674 |
|
|
END PROCESS;
|
1675 |
|
|
|
1676 |
|
|
-- Rx crc state
|
1677 |
|
|
|
1678 |
|
|
PROCESS (clk, rst)
|
1679 |
|
|
BEGIN
|
1680 |
|
|
-- IF (rst = '1') THEN
|
1681 |
|
|
-- rx_crc <= '0';
|
1682 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1683 |
|
|
IF ((reset_mode OR go_rx_crc_lim OR go_error_frame_xhdl33) = '1') THEN
|
1684 |
|
|
rx_crc <= '0' ;
|
1685 |
|
|
ELSE
|
1686 |
|
|
IF (go_rx_crc = '1') THEN
|
1687 |
|
|
rx_crc <= '1' ;
|
1688 |
|
|
END IF;
|
1689 |
|
|
END IF;
|
1690 |
|
|
IF (rst = '1') THEN
|
1691 |
|
|
rx_crc <= '0';
|
1692 |
|
|
END IF;
|
1693 |
|
|
END IF;
|
1694 |
|
|
END PROCESS;
|
1695 |
|
|
|
1696 |
|
|
-- Rx crc delimiter state
|
1697 |
|
|
|
1698 |
|
|
PROCESS (clk, rst)
|
1699 |
|
|
BEGIN
|
1700 |
|
|
-- IF (rst = '1') THEN
|
1701 |
|
|
-- rx_crc_lim <= '0';
|
1702 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1703 |
|
|
IF ((reset_mode OR go_rx_ack OR go_error_frame_xhdl33) = '1') THEN
|
1704 |
|
|
rx_crc_lim <= '0' ;
|
1705 |
|
|
ELSE
|
1706 |
|
|
IF (go_rx_crc_lim = '1') THEN
|
1707 |
|
|
rx_crc_lim <= '1' ;
|
1708 |
|
|
END IF;
|
1709 |
|
|
END IF;
|
1710 |
|
|
IF (rst = '1') THEN
|
1711 |
|
|
rx_crc_lim <= '0';
|
1712 |
|
|
END IF;
|
1713 |
|
|
END IF;
|
1714 |
|
|
END PROCESS;
|
1715 |
|
|
|
1716 |
|
|
-- Rx ack state
|
1717 |
|
|
|
1718 |
|
|
PROCESS (clk, rst)
|
1719 |
|
|
BEGIN
|
1720 |
|
|
-- IF (rst = '1') THEN
|
1721 |
|
|
-- rx_ack <= '0';
|
1722 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1723 |
|
|
IF ((reset_mode OR go_rx_ack_lim OR go_error_frame_xhdl33) = '1') THEN
|
1724 |
|
|
rx_ack <= '0' ;
|
1725 |
|
|
ELSE
|
1726 |
|
|
IF (go_rx_ack = '1') THEN
|
1727 |
|
|
rx_ack <= '1' ;
|
1728 |
|
|
END IF;
|
1729 |
|
|
END IF;
|
1730 |
|
|
IF (rst = '1') THEN
|
1731 |
|
|
rx_ack <= '0';
|
1732 |
|
|
END IF;
|
1733 |
|
|
END IF;
|
1734 |
|
|
END PROCESS;
|
1735 |
|
|
|
1736 |
|
|
-- Rx ack delimiter state
|
1737 |
|
|
|
1738 |
|
|
PROCESS (clk, rst)
|
1739 |
|
|
BEGIN
|
1740 |
|
|
-- IF (rst = '1') THEN
|
1741 |
|
|
-- rx_ack_lim <= '0';
|
1742 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1743 |
|
|
IF ((reset_mode OR go_rx_eof OR go_error_frame_xhdl33) = '1') THEN
|
1744 |
|
|
rx_ack_lim <= '0' ;
|
1745 |
|
|
ELSE
|
1746 |
|
|
IF (go_rx_ack_lim = '1') THEN
|
1747 |
|
|
rx_ack_lim <= '1' ;
|
1748 |
|
|
END IF;
|
1749 |
|
|
END IF;
|
1750 |
|
|
IF (rst = '1') THEN
|
1751 |
|
|
rx_ack_lim <= '0';
|
1752 |
|
|
END IF;
|
1753 |
|
|
END IF;
|
1754 |
|
|
END PROCESS;
|
1755 |
|
|
|
1756 |
|
|
-- Rx eof state
|
1757 |
|
|
|
1758 |
|
|
PROCESS (clk, rst)
|
1759 |
|
|
BEGIN
|
1760 |
|
|
-- IF (rst = '1') THEN
|
1761 |
|
|
-- rx_eof <= '0';
|
1762 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1763 |
|
|
IF ((reset_mode OR go_rx_inter_xhdl9 OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
1764 |
|
|
rx_eof <= '0' ;
|
1765 |
|
|
ELSE
|
1766 |
|
|
IF (go_rx_eof = '1') THEN
|
1767 |
|
|
rx_eof <= '1' ;
|
1768 |
|
|
END IF;
|
1769 |
|
|
END IF;
|
1770 |
|
|
IF (rst = '1') THEN
|
1771 |
|
|
rx_eof <= '0';
|
1772 |
|
|
END IF;
|
1773 |
|
|
END IF;
|
1774 |
|
|
END PROCESS;
|
1775 |
|
|
|
1776 |
|
|
-- Interframe space
|
1777 |
|
|
|
1778 |
|
|
PROCESS (clk, rst)
|
1779 |
|
|
BEGIN
|
1780 |
|
|
-- IF (rst = '1') THEN
|
1781 |
|
|
-- rx_inter_xhdl11 <= '0';
|
1782 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1783 |
|
|
IF ((reset_mode OR go_rx_idle OR go_rx_id1 OR go_overload_frame_xhdl32 OR go_error_frame_xhdl33) = '1') THEN
|
1784 |
|
|
rx_inter_xhdl11 <= '0' ;
|
1785 |
|
|
ELSE
|
1786 |
|
|
IF (go_rx_inter_xhdl9 = '1') THEN
|
1787 |
|
|
rx_inter_xhdl11 <= '1' ;
|
1788 |
|
|
END IF;
|
1789 |
|
|
END IF;
|
1790 |
|
|
IF (rst = '1') THEN
|
1791 |
|
|
rx_inter_xhdl11 <= '0';
|
1792 |
|
|
END IF;
|
1793 |
|
|
END IF;
|
1794 |
|
|
END PROCESS;
|
1795 |
|
|
|
1796 |
|
|
-- ID register
|
1797 |
|
|
|
1798 |
|
|
PROCESS (clk, rst)
|
1799 |
|
|
BEGIN
|
1800 |
|
|
-- IF (rst = '1') THEN
|
1801 |
|
|
-- id <= "00000000000000000000000000000";
|
1802 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1803 |
|
|
|
1804 |
|
|
IF (reset_mode = '1') THEN
|
1805 |
|
|
id <= "00000000000000000000000000000";
|
1806 |
|
|
ELSE
|
1807 |
|
|
IF (((sample_point AND (rx_id1 OR rx_id2)) AND (NOT bit_de_stuff)) = '1') THEN
|
1808 |
|
|
id <= id(27 DOWNTO 0) & sampled_bit ;
|
1809 |
|
|
END IF;
|
1810 |
|
|
END IF;
|
1811 |
|
|
IF (rst = '1') THEN
|
1812 |
|
|
id <= "00000000000000000000000000000";
|
1813 |
|
|
END IF;
|
1814 |
|
|
END IF;
|
1815 |
|
|
END PROCESS;
|
1816 |
|
|
|
1817 |
|
|
-- rtr1 bit
|
1818 |
|
|
|
1819 |
|
|
PROCESS (clk, rst)
|
1820 |
|
|
BEGIN
|
1821 |
|
|
-- IF (rst = '1') THEN
|
1822 |
|
|
-- rtr1 <= '0';
|
1823 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1824 |
|
|
IF (reset_mode = '1') THEN
|
1825 |
|
|
rtr1 <= '0';
|
1826 |
|
|
ELSE
|
1827 |
|
|
IF (((sample_point AND rx_rtr1) AND (NOT bit_de_stuff)) = '1') THEN
|
1828 |
|
|
rtr1 <= sampled_bit ;
|
1829 |
|
|
END IF;
|
1830 |
|
|
END IF;
|
1831 |
|
|
IF (rst = '1') THEN
|
1832 |
|
|
rtr1 <= '0';
|
1833 |
|
|
END IF;
|
1834 |
|
|
END IF;
|
1835 |
|
|
END PROCESS;
|
1836 |
|
|
|
1837 |
|
|
-- rtr2 bit
|
1838 |
|
|
|
1839 |
|
|
PROCESS (clk, rst)
|
1840 |
|
|
BEGIN
|
1841 |
|
|
-- IF (rst = '1') THEN
|
1842 |
|
|
-- rtr2 <= '0';
|
1843 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1844 |
|
|
IF (reset_mode = '1') THEN
|
1845 |
|
|
rtr2 <= '0';
|
1846 |
|
|
ELSE
|
1847 |
|
|
IF (((sample_point AND rx_rtr2) AND (NOT bit_de_stuff)) = '1') THEN
|
1848 |
|
|
rtr2 <= sampled_bit ;
|
1849 |
|
|
END IF;
|
1850 |
|
|
END IF;
|
1851 |
|
|
IF (rst = '1') THEN
|
1852 |
|
|
rtr2 <= '0';
|
1853 |
|
|
END IF;
|
1854 |
|
|
END IF;
|
1855 |
|
|
END PROCESS;
|
1856 |
|
|
|
1857 |
|
|
-- ide bit
|
1858 |
|
|
|
1859 |
|
|
PROCESS (clk, rst)
|
1860 |
|
|
BEGIN
|
1861 |
|
|
-- IF (rst = '1') THEN
|
1862 |
|
|
-- ide <= '0';
|
1863 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1864 |
|
|
IF (reset_mode = '1') THEN
|
1865 |
|
|
ide <= '0';
|
1866 |
|
|
ELSE
|
1867 |
|
|
IF (((sample_point AND rx_ide) AND (NOT bit_de_stuff)) = '1') THEN
|
1868 |
|
|
ide <= sampled_bit ;
|
1869 |
|
|
END IF;
|
1870 |
|
|
END IF;
|
1871 |
|
|
IF (rst = '1') THEN
|
1872 |
|
|
ide <= '0';
|
1873 |
|
|
END IF;
|
1874 |
|
|
END IF;
|
1875 |
|
|
END PROCESS;
|
1876 |
|
|
|
1877 |
|
|
-- Data length
|
1878 |
|
|
|
1879 |
|
|
PROCESS (clk, rst)
|
1880 |
|
|
BEGIN
|
1881 |
|
|
-- IF (rst = '1') THEN
|
1882 |
|
|
-- data_len <= "0000";
|
1883 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1884 |
|
|
IF (reset_mode = '1') THEN
|
1885 |
|
|
data_len <= "0000";
|
1886 |
|
|
ELSE
|
1887 |
|
|
IF (((sample_point AND rx_dlc) AND (NOT bit_de_stuff)) = '1') THEN
|
1888 |
|
|
data_len <= data_len(2 DOWNTO 0) & sampled_bit ;
|
1889 |
|
|
END IF;
|
1890 |
|
|
END IF;
|
1891 |
|
|
IF (rst = '1') THEN
|
1892 |
|
|
data_len <= "0000";
|
1893 |
|
|
END IF;
|
1894 |
|
|
END IF;
|
1895 |
|
|
END PROCESS;
|
1896 |
|
|
|
1897 |
|
|
-- Data
|
1898 |
|
|
|
1899 |
|
|
PROCESS (clk, rst)
|
1900 |
|
|
BEGIN
|
1901 |
|
|
-- IF (rst = '1') THEN
|
1902 |
|
|
-- tmp_data <= "00000000";
|
1903 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1904 |
|
|
IF (reset_mode = '1') THEN
|
1905 |
|
|
tmp_data <= "00000000";
|
1906 |
|
|
ELSE
|
1907 |
|
|
IF (((sample_point AND rx_data) AND (NOT bit_de_stuff)) = '1') THEN
|
1908 |
|
|
tmp_data <= tmp_data(6 DOWNTO 0) & sampled_bit ;
|
1909 |
|
|
END IF;
|
1910 |
|
|
END IF;
|
1911 |
|
|
IF (rst = '1') THEN
|
1912 |
|
|
tmp_data <= "00000000";
|
1913 |
|
|
END IF;
|
1914 |
|
|
END IF;
|
1915 |
|
|
END PROCESS;
|
1916 |
|
|
|
1917 |
|
|
PROCESS (clk, rst)
|
1918 |
|
|
BEGIN
|
1919 |
|
|
-- IF (rst = '1') THEN
|
1920 |
|
|
-- write_data_to_tmp_fifo <= '0';
|
1921 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1922 |
|
|
IF (reset_mode = '1') THEN
|
1923 |
|
|
write_data_to_tmp_fifo <= '0';
|
1924 |
|
|
ELSE
|
1925 |
|
|
IF ((((sample_point AND rx_data) AND (NOT bit_de_stuff)) AND (andv(bit_cnt(2 DOWNTO 0)))) = '1') THEN
|
1926 |
|
|
write_data_to_tmp_fifo <= '1' ;
|
1927 |
|
|
ELSE
|
1928 |
|
|
write_data_to_tmp_fifo <= '0' ;
|
1929 |
|
|
END IF;
|
1930 |
|
|
END IF;
|
1931 |
|
|
IF (rst = '1') THEN
|
1932 |
|
|
write_data_to_tmp_fifo <= '0';
|
1933 |
|
|
END IF;
|
1934 |
|
|
END IF;
|
1935 |
|
|
END PROCESS;
|
1936 |
|
|
|
1937 |
|
|
PROCESS (clk)
|
1938 |
|
|
BEGIN
|
1939 |
|
|
-- IF (rst = '1') THEN
|
1940 |
|
|
-- byte_cnt <= "000";
|
1941 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
1942 |
|
|
IF ((reset_mode or rst) = '1') THEN
|
1943 |
|
|
byte_cnt <= "000";
|
1944 |
|
|
ELSE
|
1945 |
|
|
IF (write_data_to_tmp_fifo = '1') THEN
|
1946 |
|
|
byte_cnt <= byte_cnt + "001" ;
|
1947 |
|
|
ELSE
|
1948 |
|
|
IF ((sample_point AND go_rx_crc_lim) = '1') THEN
|
1949 |
|
|
byte_cnt <= "000" ;
|
1950 |
|
|
END IF;
|
1951 |
|
|
END IF;
|
1952 |
|
|
END IF;
|
1953 |
|
|
-- IF (rst = '1') THENbyte_cnt <= "000";END IF;
|
1954 |
|
|
END IF;
|
1955 |
|
|
END PROCESS;
|
1956 |
|
|
|
1957 |
|
|
process (clk, rst)
|
1958 |
|
|
begin
|
1959 |
|
|
if rising_edge(clk) then
|
1960 |
|
|
wr_fifo2 <= wr_fifo;
|
1961 |
|
|
end if;
|
1962 |
|
|
if rst = '1' then
|
1963 |
|
|
wr_fifo2 <= '0';
|
1964 |
|
|
end if;
|
1965 |
|
|
end process;
|
1966 |
|
|
|
1967 |
|
|
rcv_msg_valid <= wr_fifo and not wr_fifo2;
|
1968 |
|
|
rcv_id <= id when ide = '1' else id(10 downto 0) & "11" & X"FFFF";
|
1969 |
|
|
rcv_rtr <= rtr2 when ide = '1' else rtr1;
|
1970 |
|
|
rcv_dlc <= data_len;
|
1971 |
|
|
rcv_ide <= ide;
|
1972 |
|
|
rcv_msg_data <= rx_msg_data;
|
1973 |
|
|
|
1974 |
|
|
process (clk)
|
1975 |
|
|
begin
|
1976 |
|
|
if (clk'EVENT AND clk = '1') then
|
1977 |
|
|
|
1978 |
|
|
if (write_data_to_tmp_fifo = '1') then
|
1979 |
|
|
|
1980 |
|
|
case byte_cnt is
|
1981 |
|
|
when "000" => rx_msg_data(63 downto 56) <= tmp_data;
|
1982 |
|
|
when "001" => rx_msg_data(55 downto 48) <= tmp_data;
|
1983 |
|
|
when "010" => rx_msg_data(47 downto 40) <= tmp_data;
|
1984 |
|
|
when "011" => rx_msg_data(39 downto 32) <= tmp_data;
|
1985 |
|
|
when "100" => rx_msg_data(31 downto 24) <= tmp_data;
|
1986 |
|
|
when "101" => rx_msg_data(23 downto 16) <= tmp_data;
|
1987 |
|
|
when "110" => rx_msg_data(15 downto 8) <= tmp_data;
|
1988 |
|
|
when "111" => rx_msg_data(7 downto 0) <= tmp_data;
|
1989 |
|
|
when others => null;
|
1990 |
|
|
end case;
|
1991 |
|
|
|
1992 |
|
|
end if;
|
1993 |
|
|
|
1994 |
|
|
if (rst = '1') then
|
1995 |
|
|
rx_msg_data <= (others => '0');
|
1996 |
|
|
end if;
|
1997 |
|
|
|
1998 |
|
|
end if;
|
1999 |
|
|
end process;
|
2000 |
|
|
|
2001 |
|
|
-- CRC
|
2002 |
|
|
|
2003 |
|
|
PROCESS (clk, rst)
|
2004 |
|
|
BEGIN
|
2005 |
|
|
-- IF (rst = '1') THEN
|
2006 |
|
|
-- crc_in <= "000000000000000";
|
2007 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2008 |
|
|
IF (reset_mode = '1') THEN
|
2009 |
|
|
crc_in <= "000000000000000";
|
2010 |
|
|
ELSE
|
2011 |
|
|
IF (((sample_point AND rx_crc) AND (NOT bit_de_stuff)) = '1') THEN
|
2012 |
|
|
crc_in <= crc_in(13 DOWNTO 0) & sampled_bit ;
|
2013 |
|
|
END IF;
|
2014 |
|
|
END IF;
|
2015 |
|
|
IF (rst = '1') THEN
|
2016 |
|
|
crc_in <= "000000000000000";
|
2017 |
|
|
END IF;
|
2018 |
|
|
END IF;
|
2019 |
|
|
END PROCESS;
|
2020 |
|
|
|
2021 |
|
|
-- bit_cnt
|
2022 |
|
|
|
2023 |
|
|
PROCESS (clk, rst)
|
2024 |
|
|
BEGIN
|
2025 |
|
|
-- IF (rst = '1') THEN
|
2026 |
|
|
-- bit_cnt <= "000000";
|
2027 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2028 |
|
|
IF (reset_mode = '1') THEN
|
2029 |
|
|
bit_cnt <= "000000";
|
2030 |
|
|
ELSE
|
2031 |
|
|
IF ((go_rx_id1 OR go_rx_id2 OR go_rx_dlc OR go_rx_data OR go_rx_crc OR go_rx_ack OR go_rx_eof OR go_rx_inter_xhdl9 OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
2032 |
|
|
bit_cnt <= "000000" ;
|
2033 |
|
|
ELSE
|
2034 |
|
|
IF ((sample_point AND (NOT bit_de_stuff)) = '1') THEN
|
2035 |
|
|
bit_cnt <= bit_cnt + "000001" ;
|
2036 |
|
|
END IF;
|
2037 |
|
|
END IF;
|
2038 |
|
|
END IF;
|
2039 |
|
|
IF (rst = '1') THEN
|
2040 |
|
|
bit_cnt <= "000000";
|
2041 |
|
|
END IF;
|
2042 |
|
|
END IF;
|
2043 |
|
|
END PROCESS;
|
2044 |
|
|
|
2045 |
|
|
-- eof_cnt
|
2046 |
|
|
|
2047 |
|
|
PROCESS (clk)
|
2048 |
|
|
BEGIN
|
2049 |
|
|
-- IF (rst = '1') THEN
|
2050 |
|
|
-- eof_cnt <= "000";
|
2051 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2052 |
|
|
IF ((reset_mode or rst) = '1') THEN
|
2053 |
|
|
eof_cnt <= "000";
|
2054 |
|
|
ELSE
|
2055 |
|
|
IF (sample_point = '1') THEN
|
2056 |
|
|
IF ((go_rx_inter_xhdl9 OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
2057 |
|
|
eof_cnt <= "000" ;
|
2058 |
|
|
ELSE
|
2059 |
|
|
IF (rx_eof = '1') THEN
|
2060 |
|
|
eof_cnt <= eof_cnt + "001" ;
|
2061 |
|
|
END IF;
|
2062 |
|
|
END IF;
|
2063 |
|
|
END IF;
|
2064 |
|
|
END IF;
|
2065 |
|
|
-- IF (rst = '1') THENeof_cnt <= "000";END IF;
|
2066 |
|
|
END IF;
|
2067 |
|
|
END PROCESS;
|
2068 |
|
|
|
2069 |
|
|
-- Enabling bit de-stuffing
|
2070 |
|
|
|
2071 |
|
|
PROCESS (clk, rst)
|
2072 |
|
|
BEGIN
|
2073 |
|
|
-- IF (rst = '1') THEN
|
2074 |
|
|
-- bit_stuff_cnt_en <= '0';
|
2075 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2076 |
|
|
IF (reset_mode = '1') THEN
|
2077 |
|
|
bit_stuff_cnt_en <= '0';
|
2078 |
|
|
ELSE
|
2079 |
|
|
IF (bit_de_stuff_set = '1') THEN
|
2080 |
|
|
bit_stuff_cnt_en <= '1' ;
|
2081 |
|
|
ELSE
|
2082 |
|
|
IF (bit_de_stuff_reset = '1') THEN
|
2083 |
|
|
bit_stuff_cnt_en <= '0' ;
|
2084 |
|
|
END IF;
|
2085 |
|
|
END IF;
|
2086 |
|
|
END IF;
|
2087 |
|
|
IF (rst = '1') THEN
|
2088 |
|
|
bit_stuff_cnt_en <= '0';
|
2089 |
|
|
END IF;
|
2090 |
|
|
END IF;
|
2091 |
|
|
END PROCESS;
|
2092 |
|
|
|
2093 |
|
|
-- bit_stuff_cnt
|
2094 |
|
|
|
2095 |
|
|
PROCESS (clk, rst)
|
2096 |
|
|
BEGIN
|
2097 |
|
|
-- IF (rst = '1') THEN
|
2098 |
|
|
-- bit_stuff_cnt <= "001";
|
2099 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2100 |
|
|
IF (reset_mode = '1') THEN
|
2101 |
|
|
bit_stuff_cnt <= "001";
|
2102 |
|
|
ELSE
|
2103 |
|
|
IF (bit_de_stuff_reset = '1') THEN
|
2104 |
|
|
bit_stuff_cnt <= "001" ;
|
2105 |
|
|
ELSE
|
2106 |
|
|
IF ((sample_point AND bit_stuff_cnt_en) = '1') THEN
|
2107 |
|
|
IF (bit_stuff_cnt = "101") THEN
|
2108 |
|
|
bit_stuff_cnt <= "001" ;
|
2109 |
|
|
ELSE
|
2110 |
|
|
IF (sampled_bit = sampled_bit_q) THEN
|
2111 |
|
|
bit_stuff_cnt <= bit_stuff_cnt + "001" ;
|
2112 |
|
|
ELSE
|
2113 |
|
|
bit_stuff_cnt <= "001" ;
|
2114 |
|
|
END IF;
|
2115 |
|
|
END IF;
|
2116 |
|
|
END IF;
|
2117 |
|
|
END IF;
|
2118 |
|
|
END IF;
|
2119 |
|
|
IF (rst = '1') THEN
|
2120 |
|
|
bit_stuff_cnt <= "001";
|
2121 |
|
|
END IF;
|
2122 |
|
|
END IF;
|
2123 |
|
|
END PROCESS;
|
2124 |
|
|
|
2125 |
|
|
-- bit_stuff_cnt_tx
|
2126 |
|
|
|
2127 |
|
|
PROCESS (clk, rst)
|
2128 |
|
|
BEGIN
|
2129 |
|
|
-- IF (rst = '1') THEN
|
2130 |
|
|
-- bit_stuff_cnt_tx <= "001";
|
2131 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2132 |
|
|
IF (reset_mode = '1') THEN
|
2133 |
|
|
bit_stuff_cnt_tx <= "001";
|
2134 |
|
|
ELSE
|
2135 |
|
|
IF (bit_de_stuff_reset = '1') THEN
|
2136 |
|
|
bit_stuff_cnt_tx <= "001" ;
|
2137 |
|
|
ELSE
|
2138 |
|
|
IF ((tx_point_q AND bit_stuff_cnt_en) = '1') THEN
|
2139 |
|
|
IF (bit_stuff_cnt_tx = "101") THEN
|
2140 |
|
|
bit_stuff_cnt_tx <= "001" ;
|
2141 |
|
|
ELSE
|
2142 |
|
|
IF (tx_xhdl29 = tx_q) THEN
|
2143 |
|
|
bit_stuff_cnt_tx <= bit_stuff_cnt_tx + "001" ;
|
2144 |
|
|
ELSE
|
2145 |
|
|
bit_stuff_cnt_tx <= "001" ;
|
2146 |
|
|
END IF;
|
2147 |
|
|
END IF;
|
2148 |
|
|
END IF;
|
2149 |
|
|
END IF;
|
2150 |
|
|
END IF;
|
2151 |
|
|
IF (rst = '1') THEN
|
2152 |
|
|
bit_stuff_cnt_tx <= "001";
|
2153 |
|
|
END IF;
|
2154 |
|
|
END IF;
|
2155 |
|
|
END PROCESS;
|
2156 |
|
|
bit_de_stuff <= CONV_STD_LOGIC(bit_stuff_cnt = "101") ;
|
2157 |
|
|
bit_de_stuff_tx <= CONV_STD_LOGIC(bit_stuff_cnt_tx = "101") ;
|
2158 |
|
|
-- stuff_err
|
2159 |
|
|
stuff_err <= ((sample_point AND bit_stuff_cnt_en) AND bit_de_stuff) AND CONV_STD_LOGIC(sampled_bit = sampled_bit_q) ;
|
2160 |
|
|
|
2161 |
|
|
-- Generating delayed signals
|
2162 |
|
|
|
2163 |
|
|
PROCESS (clk, rst)
|
2164 |
|
|
BEGIN
|
2165 |
|
|
-- IF (rst = '1') THEN
|
2166 |
|
|
-- reset_mode_q <= '0' ;
|
2167 |
|
|
-- node_bus_off_q <= '0' ;
|
2168 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2169 |
|
|
reset_mode_q <= reset_mode ;
|
2170 |
|
|
node_bus_off_q <= node_bus_off_xhdl13 ;
|
2171 |
|
|
IF (rst = '1') THEN
|
2172 |
|
|
reset_mode_q <= '0' ;
|
2173 |
|
|
node_bus_off_q <= '0' ;
|
2174 |
|
|
END IF;
|
2175 |
|
|
END IF;
|
2176 |
|
|
END PROCESS;
|
2177 |
|
|
|
2178 |
|
|
PROCESS (clk, rst)
|
2179 |
|
|
BEGIN
|
2180 |
|
|
-- IF (rst = '1') THEN
|
2181 |
|
|
-- crc_enable <= '0';
|
2182 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2183 |
|
|
IF ((reset_mode OR rst_crc_enable) = '1') THEN
|
2184 |
|
|
crc_enable <= '0' ;
|
2185 |
|
|
ELSE
|
2186 |
|
|
IF (go_crc_enable = '1') THEN
|
2187 |
|
|
crc_enable <= '1' ;
|
2188 |
|
|
END IF;
|
2189 |
|
|
END IF;
|
2190 |
|
|
IF (rst = '1') THEN
|
2191 |
|
|
crc_enable <= '0';
|
2192 |
|
|
END IF;
|
2193 |
|
|
END IF;
|
2194 |
|
|
END PROCESS;
|
2195 |
|
|
|
2196 |
|
|
-- CRC error generation
|
2197 |
|
|
|
2198 |
|
|
PROCESS (clk, rst)
|
2199 |
|
|
BEGIN
|
2200 |
|
|
-- IF (rst = '1') THEN
|
2201 |
|
|
-- crc_err <= '0';
|
2202 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2203 |
|
|
IF ((reset_mode OR error_frame_ended) = '1') THEN
|
2204 |
|
|
crc_err <= '0' ;
|
2205 |
|
|
ELSE
|
2206 |
|
|
IF (go_rx_ack = '1') THEN
|
2207 |
|
|
crc_err <= CONV_STD_LOGIC(crc_in /= calculated_crc) ;
|
2208 |
|
|
END IF;
|
2209 |
|
|
END IF;
|
2210 |
|
|
IF (rst = '1') THEN
|
2211 |
|
|
crc_err <= '0';
|
2212 |
|
|
END IF;
|
2213 |
|
|
END IF;
|
2214 |
|
|
END PROCESS;
|
2215 |
|
|
-- Conditions for form error
|
2216 |
|
|
form_err <= sample_point AND ((((NOT bit_de_stuff) AND rx_crc_lim) AND (NOT sampled_bit)) OR (rx_ack_lim AND (NOT sampled_bit)) OR (((CONV_STD_LOGIC(eof_cnt < "110") AND rx_eof) AND (NOT sampled_bit)) AND (NOT transmitter_xhdl8)) OR (((rx_eof) AND (NOT sampled_bit)) AND transmitter_xhdl8)) ;
|
2217 |
|
|
|
2218 |
|
|
PROCESS (clk, rst)
|
2219 |
|
|
BEGIN
|
2220 |
|
|
-- IF (rst = '1') THEN
|
2221 |
|
|
-- ack_err_latched <= '0';
|
2222 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2223 |
|
|
IF ((reset_mode OR error_frame_ended OR go_overload_frame_xhdl32) = '1') THEN
|
2224 |
|
|
ack_err_latched <= '0' ;
|
2225 |
|
|
ELSE
|
2226 |
|
|
IF (ack_err = '1') THEN
|
2227 |
|
|
ack_err_latched <= '1' ;
|
2228 |
|
|
END IF;
|
2229 |
|
|
END IF;
|
2230 |
|
|
IF (rst = '1') THEN
|
2231 |
|
|
ack_err_latched <= '0';
|
2232 |
|
|
END IF;
|
2233 |
|
|
END IF;
|
2234 |
|
|
END PROCESS;
|
2235 |
|
|
|
2236 |
|
|
PROCESS (clk, rst)
|
2237 |
|
|
BEGIN
|
2238 |
|
|
-- IF (rst = '1') THEN
|
2239 |
|
|
-- bit_err_latched <= '0';
|
2240 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2241 |
|
|
IF ((reset_mode OR error_frame_ended OR go_overload_frame_xhdl32) = '1') THEN
|
2242 |
|
|
bit_err_latched <= '0' ;
|
2243 |
|
|
ELSE
|
2244 |
|
|
IF (bit_err = '1') THEN
|
2245 |
|
|
bit_err_latched <= '1' ;
|
2246 |
|
|
END IF;
|
2247 |
|
|
END IF;
|
2248 |
|
|
IF (rst = '1') THEN
|
2249 |
|
|
bit_err_latched <= '0';
|
2250 |
|
|
END IF;
|
2251 |
|
|
END IF;
|
2252 |
|
|
END PROCESS;
|
2253 |
|
|
-- Rule 5 (Fault confinement).
|
2254 |
|
|
rule5 <= bit_err AND ((((NOT node_error_passive_xhdl26) AND error_frame) AND CONV_STD_LOGIC(error_cnt1 < "111")) OR (overload_frame_xhdl4 AND CONV_STD_LOGIC(overload_cnt1 < "111"))) ;
|
2255 |
|
|
|
2256 |
|
|
-- Rule 3 exception 1 - first part (Fault confinement).
|
2257 |
|
|
|
2258 |
|
|
PROCESS (clk, rst)
|
2259 |
|
|
BEGIN
|
2260 |
|
|
-- IF (rst = '1') THEN
|
2261 |
|
|
-- rule3_exc1_1 <= '0';
|
2262 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2263 |
|
|
IF ((reset_mode OR error_flag_over OR rule3_exc1_2) = '1') THEN
|
2264 |
|
|
rule3_exc1_1 <= '0' ;
|
2265 |
|
|
ELSE
|
2266 |
|
|
IF (((transmitter_xhdl8 AND node_error_passive_xhdl26) AND ack_err) = '1') THEN
|
2267 |
|
|
rule3_exc1_1 <= '1' ;
|
2268 |
|
|
END IF;
|
2269 |
|
|
END IF;
|
2270 |
|
|
IF (rst = '1') THEN
|
2271 |
|
|
rule3_exc1_1 <= '0';
|
2272 |
|
|
END IF;
|
2273 |
|
|
END IF;
|
2274 |
|
|
END PROCESS;
|
2275 |
|
|
|
2276 |
|
|
-- Rule 3 exception 1 - second part (Fault confinement).
|
2277 |
|
|
|
2278 |
|
|
PROCESS (clk, rst)
|
2279 |
|
|
BEGIN
|
2280 |
|
|
-- IF (rst = '1') THEN
|
2281 |
|
|
-- rule3_exc1_2 <= '0';
|
2282 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2283 |
|
|
IF ((reset_mode OR go_error_frame_xhdl33 OR rule3_exc1_2) = '1') THEN
|
2284 |
|
|
rule3_exc1_2 <= '0' ;
|
2285 |
|
|
ELSE
|
2286 |
|
|
IF ((((rule3_exc1_1 AND CONV_STD_LOGIC(error_cnt1 < "111")) AND sample_point) AND (NOT sampled_bit)) = '1') THEN
|
2287 |
|
|
rule3_exc1_2 <= '1' ;
|
2288 |
|
|
END IF;
|
2289 |
|
|
END IF;
|
2290 |
|
|
IF (rst = '1') THEN
|
2291 |
|
|
rule3_exc1_2 <= '0';
|
2292 |
|
|
END IF;
|
2293 |
|
|
END IF;
|
2294 |
|
|
END PROCESS;
|
2295 |
|
|
|
2296 |
|
|
PROCESS (clk, rst)
|
2297 |
|
|
BEGIN
|
2298 |
|
|
-- IF (rst = '1') THEN
|
2299 |
|
|
-- stuff_err_latched <= '0';
|
2300 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2301 |
|
|
IF ((reset_mode OR error_frame_ended OR go_overload_frame_xhdl32) = '1') THEN
|
2302 |
|
|
stuff_err_latched <= '0' ;
|
2303 |
|
|
ELSE
|
2304 |
|
|
IF (stuff_err = '1') THEN
|
2305 |
|
|
stuff_err_latched <= '1' ;
|
2306 |
|
|
END IF;
|
2307 |
|
|
END IF;
|
2308 |
|
|
IF (rst = '1') THEN
|
2309 |
|
|
stuff_err_latched <= '0';
|
2310 |
|
|
END IF;
|
2311 |
|
|
END IF;
|
2312 |
|
|
END PROCESS;
|
2313 |
|
|
|
2314 |
|
|
PROCESS (clk, rst)
|
2315 |
|
|
BEGIN
|
2316 |
|
|
-- IF (rst = '1') THEN
|
2317 |
|
|
-- form_err_latched <= '0';
|
2318 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2319 |
|
|
IF ((reset_mode OR error_frame_ended OR go_overload_frame_xhdl32) = '1') THEN
|
2320 |
|
|
form_err_latched <= '0' ;
|
2321 |
|
|
ELSE
|
2322 |
|
|
IF (form_err = '1') THEN
|
2323 |
|
|
form_err_latched <= '1' ;
|
2324 |
|
|
END IF;
|
2325 |
|
|
END IF;
|
2326 |
|
|
IF (rst = '1') THEN
|
2327 |
|
|
form_err_latched <= '0';
|
2328 |
|
|
END IF;
|
2329 |
|
|
END IF;
|
2330 |
|
|
END PROCESS;
|
2331 |
|
|
|
2332 |
|
|
xhdl_49 <= ((crc_enable AND sample_point) AND (NOT bit_de_stuff));
|
2333 |
|
|
i_can_crc_core_sync_rx : can_crc_core_sync
|
2334 |
|
|
PORT MAP (
|
2335 |
|
|
clk => clk,
|
2336 |
|
|
data => sampled_bit,
|
2337 |
|
|
enable => xhdl_49,
|
2338 |
|
|
initialize => go_crc_enable,
|
2339 |
|
|
crc => calculated_crc);
|
2340 |
|
|
|
2341 |
|
|
no_byte0 <= rtr1 OR CONV_STD_LOGIC(data_len < "0001") ;
|
2342 |
|
|
no_byte1 <= rtr1 OR CONV_STD_LOGIC(data_len < "0010") ;
|
2343 |
|
|
|
2344 |
|
|
temp_xhdl75 <= "101" WHEN ide = '1' ELSE "011";
|
2345 |
|
|
temp_xhdl76 <= (temp_xhdl75) WHEN extended_mode = '1' ELSE "010";
|
2346 |
|
|
header_len(2 DOWNTO 0) <= temp_xhdl76 ;
|
2347 |
|
|
storing_header <= CONV_STD_LOGIC(header_cnt < header_len) ;
|
2348 |
|
|
temp_xhdl77 <= (data_len - "0001") WHEN (data_len < "1000") ELSE "0111";
|
2349 |
|
|
temp_xhdl78 <= "1111" WHEN remote_rq = '1' ELSE (temp_xhdl77);
|
2350 |
|
|
limited_data_len_minus1(3 DOWNTO 0) <= temp_xhdl78 ;
|
2351 |
|
|
reset_wr_fifo <= CONV_STD_LOGIC(data_cnt = (limited_data_len_minus1 + ('0' & header_len))) OR reset_mode ;
|
2352 |
|
|
err <= form_err OR stuff_err OR bit_err OR ack_err OR form_err_latched OR stuff_err_latched OR bit_err_latched OR ack_err_latched OR crc_err ;
|
2353 |
|
|
|
2354 |
|
|
|
2355 |
|
|
id_ok <= '1';
|
2356 |
|
|
|
2357 |
|
|
-- Write enable signal for 64-byte rx fifo
|
2358 |
|
|
|
2359 |
|
|
PROCESS (clk, rst)
|
2360 |
|
|
BEGIN
|
2361 |
|
|
-- IF (rst = '1') THEN
|
2362 |
|
|
-- wr_fifo <= '0';
|
2363 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2364 |
|
|
IF (reset_wr_fifo = '1') THEN
|
2365 |
|
|
wr_fifo <= '0' ;
|
2366 |
|
|
ELSE
|
2367 |
|
|
IF ((((go_rx_inter_xhdl9 AND id_ok) AND (NOT error_frame_ended)) AND ((NOT tx_state_xhdl2) OR self_rx_request)) = '1') THEN
|
2368 |
|
|
wr_fifo <= '1' ;
|
2369 |
|
|
END IF;
|
2370 |
|
|
END IF;
|
2371 |
|
|
IF (rst = '1') THEN
|
2372 |
|
|
wr_fifo <= '0';
|
2373 |
|
|
END IF;
|
2374 |
|
|
END IF;
|
2375 |
|
|
END PROCESS;
|
2376 |
|
|
|
2377 |
|
|
-- Header counter. Header length depends on the mode of operation and frame format.
|
2378 |
|
|
|
2379 |
|
|
PROCESS (clk, rst)
|
2380 |
|
|
BEGIN
|
2381 |
|
|
-- IF (rst = '1') THEN
|
2382 |
|
|
-- header_cnt <= "000";
|
2383 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2384 |
|
|
IF (reset_wr_fifo = '1') THEN
|
2385 |
|
|
header_cnt <= "000" ;
|
2386 |
|
|
ELSE
|
2387 |
|
|
IF ((wr_fifo AND storing_header) = '1') THEN
|
2388 |
|
|
header_cnt <= header_cnt + "001" ;
|
2389 |
|
|
END IF;
|
2390 |
|
|
END IF;
|
2391 |
|
|
IF (rst = '1') THEN
|
2392 |
|
|
header_cnt <= "000";
|
2393 |
|
|
END IF;
|
2394 |
|
|
END IF;
|
2395 |
|
|
END PROCESS;
|
2396 |
|
|
|
2397 |
|
|
-- Data counter. Length of the data is limited to 8 bytes.
|
2398 |
|
|
|
2399 |
|
|
PROCESS (clk, rst)
|
2400 |
|
|
BEGIN
|
2401 |
|
|
-- IF (rst = '1') THEN
|
2402 |
|
|
-- data_cnt <= "0000";
|
2403 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2404 |
|
|
IF (reset_wr_fifo = '1') THEN
|
2405 |
|
|
data_cnt <= "0000" ;
|
2406 |
|
|
ELSE
|
2407 |
|
|
IF (wr_fifo = '1') THEN
|
2408 |
|
|
data_cnt <= data_cnt + "0001" ;
|
2409 |
|
|
END IF;
|
2410 |
|
|
END IF;
|
2411 |
|
|
IF (rst = '1') THEN
|
2412 |
|
|
data_cnt <= "0000";
|
2413 |
|
|
END IF;
|
2414 |
|
|
END IF;
|
2415 |
|
|
END PROCESS;
|
2416 |
|
|
|
2417 |
|
|
-- Transmitting error frame.
|
2418 |
|
|
|
2419 |
|
|
PROCESS (clk, rst)
|
2420 |
|
|
BEGIN
|
2421 |
|
|
-- IF (rst = '1') THEN
|
2422 |
|
|
-- error_frame <= '0';
|
2423 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2424 |
|
|
IF ((reset_mode OR error_frame_ended OR go_overload_frame_xhdl32) = '1') THEN
|
2425 |
|
|
error_frame <= '0' ;
|
2426 |
|
|
ELSE
|
2427 |
|
|
IF (go_error_frame_xhdl33 = '1') THEN
|
2428 |
|
|
error_frame <= '1' ;
|
2429 |
|
|
END IF;
|
2430 |
|
|
END IF;
|
2431 |
|
|
IF (rst = '1') THEN
|
2432 |
|
|
error_frame <= '0';
|
2433 |
|
|
END IF;
|
2434 |
|
|
END IF;
|
2435 |
|
|
END PROCESS;
|
2436 |
|
|
|
2437 |
|
|
PROCESS (clk, rst)
|
2438 |
|
|
BEGIN
|
2439 |
|
|
-- IF (rst = '1') THEN
|
2440 |
|
|
-- error_cnt1 <= "000";
|
2441 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2442 |
|
|
IF ((reset_mode OR error_frame_ended OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
2443 |
|
|
error_cnt1 <= "000" ;
|
2444 |
|
|
ELSE
|
2445 |
|
|
IF (((error_frame AND tx_point) AND CONV_STD_LOGIC(error_cnt1 < "111")) = '1') THEN
|
2446 |
|
|
error_cnt1 <= error_cnt1 + "001" ;
|
2447 |
|
|
END IF;
|
2448 |
|
|
END IF;
|
2449 |
|
|
IF (rst = '1') THEN
|
2450 |
|
|
error_cnt1 <= "000";
|
2451 |
|
|
END IF;
|
2452 |
|
|
END IF;
|
2453 |
|
|
END PROCESS;
|
2454 |
|
|
error_flag_over <= ((((NOT node_error_passive_xhdl26) AND sample_point) AND CONV_STD_LOGIC(error_cnt1 = "111")) OR ((node_error_passive_xhdl26 AND sample_point) AND CONV_STD_LOGIC(passive_cnt = "110"))) AND (NOT enable_error_cnt2) ;
|
2455 |
|
|
|
2456 |
|
|
PROCESS (clk, rst)
|
2457 |
|
|
BEGIN
|
2458 |
|
|
-- IF (rst = '1') THEN
|
2459 |
|
|
-- error_flag_over_latched <= '0';
|
2460 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2461 |
|
|
IF ((reset_mode OR error_frame_ended OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
2462 |
|
|
error_flag_over_latched <= '0' ;
|
2463 |
|
|
ELSE
|
2464 |
|
|
IF (error_flag_over = '1') THEN
|
2465 |
|
|
error_flag_over_latched <= '1' ;
|
2466 |
|
|
END IF;
|
2467 |
|
|
END IF;
|
2468 |
|
|
IF (rst = '1') THEN
|
2469 |
|
|
error_flag_over_latched <= '0';
|
2470 |
|
|
END IF;
|
2471 |
|
|
END IF;
|
2472 |
|
|
END PROCESS;
|
2473 |
|
|
|
2474 |
|
|
PROCESS (clk, rst)
|
2475 |
|
|
BEGIN
|
2476 |
|
|
-- IF (rst = '1') THEN
|
2477 |
|
|
-- enable_error_cnt2 <= '0';
|
2478 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2479 |
|
|
IF ((reset_mode OR error_frame_ended OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
2480 |
|
|
enable_error_cnt2 <= '0' ;
|
2481 |
|
|
ELSE
|
2482 |
|
|
IF ((error_frame AND (error_flag_over AND sampled_bit)) = '1') THEN
|
2483 |
|
|
enable_error_cnt2 <= '1' ;
|
2484 |
|
|
END IF;
|
2485 |
|
|
END IF;
|
2486 |
|
|
IF (rst = '1') THEN
|
2487 |
|
|
enable_error_cnt2 <= '0';
|
2488 |
|
|
END IF;
|
2489 |
|
|
END IF;
|
2490 |
|
|
END PROCESS;
|
2491 |
|
|
|
2492 |
|
|
PROCESS (clk, rst)
|
2493 |
|
|
BEGIN
|
2494 |
|
|
-- IF (rst = '1') THEN
|
2495 |
|
|
-- error_cnt2 <= "000";
|
2496 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2497 |
|
|
IF ((reset_mode OR error_frame_ended OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
2498 |
|
|
error_cnt2 <= "000" ;
|
2499 |
|
|
ELSE
|
2500 |
|
|
IF ((enable_error_cnt2 AND tx_point) = '1') THEN
|
2501 |
|
|
error_cnt2 <= error_cnt2 + "001" ;
|
2502 |
|
|
END IF;
|
2503 |
|
|
END IF;
|
2504 |
|
|
IF (rst = '1') THEN
|
2505 |
|
|
error_cnt2 <= "000";
|
2506 |
|
|
END IF;
|
2507 |
|
|
END IF;
|
2508 |
|
|
END PROCESS;
|
2509 |
|
|
|
2510 |
|
|
PROCESS (clk, rst)
|
2511 |
|
|
BEGIN
|
2512 |
|
|
-- IF (rst = '1') THEN
|
2513 |
|
|
-- delayed_dominant_cnt <= "000";
|
2514 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2515 |
|
|
IF ((reset_mode OR enable_error_cnt2 OR go_error_frame_xhdl33 OR enable_overload_cnt2 OR go_overload_frame_xhdl32) = '1') THEN
|
2516 |
|
|
delayed_dominant_cnt <= "000" ;
|
2517 |
|
|
ELSE
|
2518 |
|
|
IF (((sample_point AND (NOT sampled_bit)) AND CONV_STD_LOGIC((error_cnt1 = "111") OR (overload_cnt1 = "111"))) = '1') THEN
|
2519 |
|
|
delayed_dominant_cnt <= delayed_dominant_cnt + "001" ;
|
2520 |
|
|
END IF;
|
2521 |
|
|
END IF;
|
2522 |
|
|
IF (rst = '1') THEN
|
2523 |
|
|
delayed_dominant_cnt <= "000";
|
2524 |
|
|
END IF;
|
2525 |
|
|
END IF;
|
2526 |
|
|
END PROCESS;
|
2527 |
|
|
|
2528 |
|
|
-- passive_cnt
|
2529 |
|
|
|
2530 |
|
|
PROCESS (clk, rst)
|
2531 |
|
|
BEGIN
|
2532 |
|
|
-- IF (rst = '1') THEN
|
2533 |
|
|
-- passive_cnt <= "001";
|
2534 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2535 |
|
|
IF ((reset_mode OR error_frame_ended OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32 OR first_compare_bit) = '1') THEN
|
2536 |
|
|
passive_cnt <= "001" ;
|
2537 |
|
|
ELSE
|
2538 |
|
|
IF ((sample_point AND CONV_STD_LOGIC(passive_cnt < "110")) = '1') THEN
|
2539 |
|
|
IF (((error_frame AND (NOT enable_error_cnt2)) AND CONV_STD_LOGIC(sampled_bit = sampled_bit_q)) = '1') THEN
|
2540 |
|
|
passive_cnt <= passive_cnt + "001" ;
|
2541 |
|
|
ELSE
|
2542 |
|
|
passive_cnt <= "001" ;
|
2543 |
|
|
END IF;
|
2544 |
|
|
END IF;
|
2545 |
|
|
END IF;
|
2546 |
|
|
IF (rst = '1') THEN
|
2547 |
|
|
passive_cnt <= "001";
|
2548 |
|
|
END IF;
|
2549 |
|
|
END IF;
|
2550 |
|
|
END PROCESS;
|
2551 |
|
|
|
2552 |
|
|
-- When comparing 6 equal bits, first is always equal
|
2553 |
|
|
|
2554 |
|
|
PROCESS (clk, rst)
|
2555 |
|
|
BEGIN
|
2556 |
|
|
-- IF (rst = '1') THEN
|
2557 |
|
|
-- first_compare_bit <= '0';
|
2558 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2559 |
|
|
IF (go_error_frame_xhdl33 = '1') THEN
|
2560 |
|
|
first_compare_bit <= '1' ;
|
2561 |
|
|
ELSE
|
2562 |
|
|
IF (sample_point = '1') THEN
|
2563 |
|
|
first_compare_bit <= '0';
|
2564 |
|
|
END IF;
|
2565 |
|
|
END IF;
|
2566 |
|
|
IF (rst = '1') THEN
|
2567 |
|
|
first_compare_bit <= '0';
|
2568 |
|
|
END IF;
|
2569 |
|
|
END IF;
|
2570 |
|
|
END PROCESS;
|
2571 |
|
|
|
2572 |
|
|
-- Transmitting overload frame.
|
2573 |
|
|
|
2574 |
|
|
PROCESS (clk, rst)
|
2575 |
|
|
BEGIN
|
2576 |
|
|
-- IF (rst = '1') THEN
|
2577 |
|
|
-- overload_frame_xhdl4 <= '0';
|
2578 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2579 |
|
|
IF ((reset_mode OR overload_frame_ended OR go_error_frame_xhdl33) = '1') THEN
|
2580 |
|
|
overload_frame_xhdl4 <= '0' ;
|
2581 |
|
|
ELSE
|
2582 |
|
|
IF (go_overload_frame_xhdl32 = '1') THEN
|
2583 |
|
|
overload_frame_xhdl4 <= '1' ;
|
2584 |
|
|
END IF;
|
2585 |
|
|
END IF;
|
2586 |
|
|
IF (rst = '1') THEN
|
2587 |
|
|
overload_frame_xhdl4 <= '0';
|
2588 |
|
|
END IF;
|
2589 |
|
|
END IF;
|
2590 |
|
|
END PROCESS;
|
2591 |
|
|
|
2592 |
|
|
PROCESS (clk, rst)
|
2593 |
|
|
BEGIN
|
2594 |
|
|
-- IF (rst = '1') THEN
|
2595 |
|
|
-- overload_cnt1 <= "000";
|
2596 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2597 |
|
|
IF ((reset_mode OR overload_frame_ended OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
2598 |
|
|
overload_cnt1 <= "000" ;
|
2599 |
|
|
ELSE
|
2600 |
|
|
IF (((overload_frame_xhdl4 AND tx_point) AND CONV_STD_LOGIC(overload_cnt1 < "111")) = '1') THEN
|
2601 |
|
|
overload_cnt1 <= overload_cnt1 + "001" ;
|
2602 |
|
|
END IF;
|
2603 |
|
|
END IF;
|
2604 |
|
|
IF (rst = '1') THEN
|
2605 |
|
|
overload_cnt1 <= "000";
|
2606 |
|
|
END IF;
|
2607 |
|
|
END IF;
|
2608 |
|
|
END PROCESS;
|
2609 |
|
|
overload_flag_over <= (sample_point AND CONV_STD_LOGIC(overload_cnt1 = "111")) AND (NOT enable_overload_cnt2) ;
|
2610 |
|
|
|
2611 |
|
|
PROCESS (clk, rst)
|
2612 |
|
|
BEGIN
|
2613 |
|
|
-- IF (rst = '1') THEN
|
2614 |
|
|
-- enable_overload_cnt2 <= '0';
|
2615 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2616 |
|
|
IF ((reset_mode OR overload_frame_ended OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
2617 |
|
|
enable_overload_cnt2 <= '0' ;
|
2618 |
|
|
ELSE
|
2619 |
|
|
IF ((overload_frame_xhdl4 AND (overload_flag_over AND sampled_bit)) = '1') THEN
|
2620 |
|
|
enable_overload_cnt2 <= '1' ;
|
2621 |
|
|
END IF;
|
2622 |
|
|
END IF;
|
2623 |
|
|
IF (rst = '1') THEN
|
2624 |
|
|
enable_overload_cnt2 <= '0';
|
2625 |
|
|
END IF;
|
2626 |
|
|
END IF;
|
2627 |
|
|
END PROCESS;
|
2628 |
|
|
|
2629 |
|
|
PROCESS (clk, rst)
|
2630 |
|
|
BEGIN
|
2631 |
|
|
-- IF (rst = '1') THEN
|
2632 |
|
|
-- overload_cnt2 <= "000";
|
2633 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2634 |
|
|
IF ((reset_mode OR overload_frame_ended OR go_error_frame_xhdl33 OR go_overload_frame_xhdl32) = '1') THEN
|
2635 |
|
|
overload_cnt2 <= "000" ;
|
2636 |
|
|
ELSE
|
2637 |
|
|
IF ((enable_overload_cnt2 AND tx_point) = '1') THEN
|
2638 |
|
|
overload_cnt2 <= overload_cnt2 + "001" ;
|
2639 |
|
|
END IF;
|
2640 |
|
|
END IF;
|
2641 |
|
|
IF (rst = '1') THEN
|
2642 |
|
|
overload_cnt2 <= "000";
|
2643 |
|
|
END IF;
|
2644 |
|
|
END IF;
|
2645 |
|
|
END PROCESS;
|
2646 |
|
|
|
2647 |
|
|
PROCESS (clk, rst)
|
2648 |
|
|
BEGIN
|
2649 |
|
|
-- IF (rst = '1') THEN
|
2650 |
|
|
-- overload_request_cnt <= "00";
|
2651 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2652 |
|
|
IF ((reset_mode OR go_error_frame_xhdl33 OR go_rx_id1) = '1') THEN
|
2653 |
|
|
overload_request_cnt <= "00" ;
|
2654 |
|
|
ELSE
|
2655 |
|
|
IF ((overload_request AND overload_frame_xhdl4) = '1') THEN
|
2656 |
|
|
overload_request_cnt <= overload_request_cnt + "01" ;
|
2657 |
|
|
END IF;
|
2658 |
|
|
END IF;
|
2659 |
|
|
IF (rst = '1') THEN
|
2660 |
|
|
overload_request_cnt <= "00";
|
2661 |
|
|
END IF;
|
2662 |
|
|
END IF;
|
2663 |
|
|
END PROCESS;
|
2664 |
|
|
|
2665 |
|
|
PROCESS (clk, rst)
|
2666 |
|
|
BEGIN
|
2667 |
|
|
-- IF (rst = '1') THEN
|
2668 |
|
|
-- overload_frame_blocked <= '0';
|
2669 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2670 |
|
|
IF ((reset_mode OR go_error_frame_xhdl33 OR go_rx_id1) = '1') THEN
|
2671 |
|
|
overload_frame_blocked <= '0' ;
|
2672 |
|
|
ELSE
|
2673 |
|
|
IF (((overload_request AND overload_frame_xhdl4) AND CONV_STD_LOGIC(overload_request_cnt = "10")) = '1') THEN
|
2674 |
|
|
-- This is a second sequential overload_request
|
2675 |
|
|
|
2676 |
|
|
overload_frame_blocked <= '1' ;
|
2677 |
|
|
END IF;
|
2678 |
|
|
END IF;
|
2679 |
|
|
IF (rst = '1') THEN
|
2680 |
|
|
overload_frame_blocked <= '0';
|
2681 |
|
|
END IF;
|
2682 |
|
|
END IF;
|
2683 |
|
|
END PROCESS;
|
2684 |
|
|
send_ack_xhdl35 <= (((NOT tx_state_xhdl2) AND rx_ack) AND (NOT err)) AND (NOT listen_only_mode) ;
|
2685 |
|
|
|
2686 |
|
|
PROCESS (reset_mode, node_bus_off_xhdl13, tx_state_xhdl2, go_tx_xhdl34, bit_de_stuff_tx, tx_bit, tx_q, send_ack_xhdl35, go_overload_frame_xhdl32, overload_frame_xhdl4, overload_cnt1, go_error_frame_xhdl33, error_frame, error_cnt1, node_error_passive_xhdl26)
|
2687 |
|
|
VARIABLE tx_next_xhdl30_xhdl105 : std_logic;
|
2688 |
|
|
BEGIN
|
2689 |
|
|
IF ((reset_mode OR node_bus_off_xhdl13) = '1') THEN
|
2690 |
|
|
-- Reset or node_bus_off
|
2691 |
|
|
|
2692 |
|
|
tx_next_xhdl30_xhdl105 := '1';
|
2693 |
|
|
ELSE
|
2694 |
|
|
IF ((go_error_frame_xhdl33 OR error_frame) = '1') THEN
|
2695 |
|
|
-- Transmitting error frame
|
2696 |
|
|
|
2697 |
|
|
IF (error_cnt1 < "110") THEN
|
2698 |
|
|
IF (node_error_passive_xhdl26 = '1') THEN
|
2699 |
|
|
tx_next_xhdl30_xhdl105 := '1';
|
2700 |
|
|
ELSE
|
2701 |
|
|
tx_next_xhdl30_xhdl105 := '0';
|
2702 |
|
|
END IF;
|
2703 |
|
|
ELSE
|
2704 |
|
|
tx_next_xhdl30_xhdl105 := '1';
|
2705 |
|
|
END IF;
|
2706 |
|
|
ELSE
|
2707 |
|
|
IF ((go_overload_frame_xhdl32 OR overload_frame_xhdl4) = '1') THEN
|
2708 |
|
|
-- Transmitting overload frame
|
2709 |
|
|
|
2710 |
|
|
IF (overload_cnt1 < "110") THEN
|
2711 |
|
|
tx_next_xhdl30_xhdl105 := '0';
|
2712 |
|
|
ELSE
|
2713 |
|
|
tx_next_xhdl30_xhdl105 := '1';
|
2714 |
|
|
END IF;
|
2715 |
|
|
ELSE
|
2716 |
|
|
IF ((go_tx_xhdl34 OR tx_state_xhdl2) = '1') THEN
|
2717 |
|
|
-- Transmitting message
|
2718 |
|
|
|
2719 |
|
|
tx_next_xhdl30_xhdl105 := ((NOT bit_de_stuff_tx) AND tx_bit) OR (bit_de_stuff_tx AND (NOT tx_q));
|
2720 |
|
|
ELSE
|
2721 |
|
|
IF (send_ack_xhdl35 = '1') THEN
|
2722 |
|
|
-- Acknowledge
|
2723 |
|
|
|
2724 |
|
|
tx_next_xhdl30_xhdl105 := '0';
|
2725 |
|
|
ELSE
|
2726 |
|
|
tx_next_xhdl30_xhdl105 := '1';
|
2727 |
|
|
END IF;
|
2728 |
|
|
END IF;
|
2729 |
|
|
END IF;
|
2730 |
|
|
END IF;
|
2731 |
|
|
END IF;
|
2732 |
|
|
tx_next_xhdl30 <= tx_next_xhdl30_xhdl105;
|
2733 |
|
|
END PROCESS;
|
2734 |
|
|
|
2735 |
|
|
PROCESS (clk, rst)
|
2736 |
|
|
BEGIN
|
2737 |
|
|
-- IF (rst = '1') THEN
|
2738 |
|
|
-- tx_xhdl29 <= '1';
|
2739 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2740 |
|
|
IF (reset_mode = '1') THEN
|
2741 |
|
|
tx_xhdl29 <= '1';
|
2742 |
|
|
ELSE
|
2743 |
|
|
IF (tx_point = '1') THEN
|
2744 |
|
|
tx_xhdl29 <= tx_next_xhdl30 ;
|
2745 |
|
|
END IF;
|
2746 |
|
|
END IF;
|
2747 |
|
|
IF (rst = '1') THEN
|
2748 |
|
|
tx_xhdl29 <= '1';
|
2749 |
|
|
END IF;
|
2750 |
|
|
END IF;
|
2751 |
|
|
END PROCESS;
|
2752 |
|
|
|
2753 |
|
|
PROCESS (clk, rst)
|
2754 |
|
|
BEGIN
|
2755 |
|
|
-- IF (rst = '1') THEN
|
2756 |
|
|
-- tx_q <= '0' ;
|
2757 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2758 |
|
|
IF (reset_mode = '1') THEN
|
2759 |
|
|
tx_q <= '0' ;
|
2760 |
|
|
ELSE
|
2761 |
|
|
IF (tx_point = '1') THEN
|
2762 |
|
|
tx_q <= tx_xhdl29 AND (NOT go_early_tx_latched) ;
|
2763 |
|
|
END IF;
|
2764 |
|
|
END IF;
|
2765 |
|
|
IF (rst = '1') THEN
|
2766 |
|
|
tx_q <= '0' ;
|
2767 |
|
|
END IF;
|
2768 |
|
|
END IF;
|
2769 |
|
|
END PROCESS;
|
2770 |
|
|
|
2771 |
|
|
-- Delayed tx point
|
2772 |
|
|
PROCESS (clk, rst)
|
2773 |
|
|
BEGIN
|
2774 |
|
|
-- IF (rst = '1') THEN
|
2775 |
|
|
-- tx_point_q <= '0' ;
|
2776 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2777 |
|
|
IF (reset_mode = '1') THEN
|
2778 |
|
|
tx_point_q <= '0' ;
|
2779 |
|
|
ELSE
|
2780 |
|
|
tx_point_q <= tx_point ;
|
2781 |
|
|
END IF;
|
2782 |
|
|
IF (rst = '1') THEN
|
2783 |
|
|
tx_point_q <= '0' ;
|
2784 |
|
|
END IF;
|
2785 |
|
|
END IF;
|
2786 |
|
|
END PROCESS;
|
2787 |
|
|
|
2788 |
|
|
-- Changing bit order from [7:0] to [0:7]
|
2789 |
|
|
i_ibo_tx_data_0 : can_ibo_core_sync
|
2790 |
|
|
PORT MAP (
|
2791 |
|
|
di => tx_data_0,
|
2792 |
|
|
do => r_tx_data_0);
|
2793 |
|
|
|
2794 |
|
|
i_ibo_tx_data_1 : can_ibo_core_sync
|
2795 |
|
|
PORT MAP (
|
2796 |
|
|
di => tx_data_1,
|
2797 |
|
|
do => r_tx_data_1);
|
2798 |
|
|
|
2799 |
|
|
i_ibo_tx_data_2 : can_ibo_core_sync
|
2800 |
|
|
PORT MAP (
|
2801 |
|
|
di => tx_data_2,
|
2802 |
|
|
do => r_tx_data_2);
|
2803 |
|
|
|
2804 |
|
|
i_ibo_tx_data_3 : can_ibo_core_sync
|
2805 |
|
|
PORT MAP (
|
2806 |
|
|
di => tx_data_3,
|
2807 |
|
|
do => r_tx_data_3);
|
2808 |
|
|
|
2809 |
|
|
i_ibo_tx_data_4 : can_ibo_core_sync
|
2810 |
|
|
PORT MAP (
|
2811 |
|
|
di => tx_data_4,
|
2812 |
|
|
do => r_tx_data_4);
|
2813 |
|
|
|
2814 |
|
|
i_ibo_tx_data_5 : can_ibo_core_sync
|
2815 |
|
|
PORT MAP (
|
2816 |
|
|
di => tx_data_5,
|
2817 |
|
|
do => r_tx_data_5);
|
2818 |
|
|
|
2819 |
|
|
i_ibo_tx_data_6 : can_ibo_core_sync
|
2820 |
|
|
PORT MAP (
|
2821 |
|
|
di => tx_data_6,
|
2822 |
|
|
do => r_tx_data_6);
|
2823 |
|
|
|
2824 |
|
|
i_ibo_tx_data_7 : can_ibo_core_sync
|
2825 |
|
|
PORT MAP (
|
2826 |
|
|
di => tx_data_7,
|
2827 |
|
|
do => r_tx_data_7);
|
2828 |
|
|
|
2829 |
|
|
i_ibo_tx_data_8 : can_ibo_core_sync
|
2830 |
|
|
PORT MAP (
|
2831 |
|
|
di => tx_data_8,
|
2832 |
|
|
do => r_tx_data_8);
|
2833 |
|
|
|
2834 |
|
|
i_ibo_tx_data_9 : can_ibo_core_sync
|
2835 |
|
|
PORT MAP (
|
2836 |
|
|
di => tx_data_9,
|
2837 |
|
|
do => r_tx_data_9);
|
2838 |
|
|
|
2839 |
|
|
i_ibo_tx_data_10 : can_ibo_core_sync
|
2840 |
|
|
PORT MAP (
|
2841 |
|
|
di => tx_data_10,
|
2842 |
|
|
do => r_tx_data_10);
|
2843 |
|
|
|
2844 |
|
|
i_ibo_tx_data_11 : can_ibo_core_sync
|
2845 |
|
|
PORT MAP (
|
2846 |
|
|
di => tx_data_11,
|
2847 |
|
|
do => r_tx_data_11);
|
2848 |
|
|
|
2849 |
|
|
i_ibo_tx_data_12 : can_ibo_core_sync
|
2850 |
|
|
PORT MAP (
|
2851 |
|
|
di => tx_data_12,
|
2852 |
|
|
do => r_tx_data_12);
|
2853 |
|
|
|
2854 |
|
|
|
2855 |
|
|
-- Changing bit order from [14:0] to [0:14]
|
2856 |
|
|
i_calculated_crc0 : can_ibo_core_sync
|
2857 |
|
|
PORT MAP (
|
2858 |
|
|
di => calculated_crc(14 DOWNTO 7),
|
2859 |
|
|
do => r_calculated_crc(7 DOWNTO 0));
|
2860 |
|
|
|
2861 |
|
|
xhdl_106 <= calculated_crc(6 DOWNTO 0) & '0';
|
2862 |
|
|
i_calculated_crc1 : can_ibo_core_sync
|
2863 |
|
|
PORT MAP (
|
2864 |
|
|
di => xhdl_106,
|
2865 |
|
|
do => r_calculated_crc(15 DOWNTO 8));
|
2866 |
|
|
|
2867 |
|
|
basic_chain <= r_tx_data_1(7 DOWNTO 4) & "00" & r_tx_data_1(3 DOWNTO 0) & r_tx_data_0(7 DOWNTO 0) & '0' ;
|
2868 |
|
|
basic_chain_data <= r_tx_data_9 & r_tx_data_8 & r_tx_data_7 & r_tx_data_6 & r_tx_data_5 & r_tx_data_4 & r_tx_data_3 & r_tx_data_2 ;
|
2869 |
|
|
extended_chain_std <= r_tx_data_0(7 DOWNTO 4) & "00" & r_tx_data_0(1) & r_tx_data_2(2 DOWNTO 0) & r_tx_data_1(7 DOWNTO 0) & '0' ;
|
2870 |
|
|
extended_chain_ext <= r_tx_data_0(7 DOWNTO 4) & "00" & r_tx_data_0(1) & r_tx_data_4(4 DOWNTO 0) & r_tx_data_3(7 DOWNTO 0) & r_tx_data_2(7 DOWNTO 3) & '1' & '1' & r_tx_data_2(2 DOWNTO 0) & r_tx_data_1(7 DOWNTO 0) & '0' ;
|
2871 |
|
|
extended_chain_data_std <= r_tx_data_10 & r_tx_data_9 & r_tx_data_8 & r_tx_data_7 & r_tx_data_6 & r_tx_data_5 & r_tx_data_4 & r_tx_data_3 ;
|
2872 |
|
|
extended_chain_data_ext <= r_tx_data_12 & r_tx_data_11 & r_tx_data_10 & r_tx_data_9 & r_tx_data_8 & r_tx_data_7 & r_tx_data_6 & r_tx_data_5 ;
|
2873 |
|
|
|
2874 |
|
|
PROCESS (extended_mode, rx_data, tx_pointer, extended_chain_data_std, extended_chain_data_ext, rx_crc, r_calculated_crc, r_tx_data_0, extended_chain_ext, extended_chain_std, basic_chain_data, basic_chain, finish_msg)
|
2875 |
|
|
VARIABLE tx_bit_xhdl107 : std_logic;
|
2876 |
|
|
BEGIN
|
2877 |
|
|
IF (extended_mode = '1') THEN
|
2878 |
|
|
IF (rx_data = '1') THEN
|
2879 |
|
|
-- data stage
|
2880 |
|
|
|
2881 |
|
|
IF (r_tx_data_0(0) = '1') THEN
|
2882 |
|
|
-- Extended frame
|
2883 |
|
|
|
2884 |
|
|
tx_bit_xhdl107 := extended_chain_data_ext(conv_integer(tx_pointer));
|
2885 |
|
|
ELSE
|
2886 |
|
|
tx_bit_xhdl107 := extended_chain_data_std(conv_integer(tx_pointer));
|
2887 |
|
|
END IF;
|
2888 |
|
|
ELSE
|
2889 |
|
|
IF (rx_crc = '1') THEN
|
2890 |
|
|
tx_bit_xhdl107 := r_calculated_crc(conv_integer(tx_pointer(3 downto 0)));
|
2891 |
|
|
ELSE
|
2892 |
|
|
IF (finish_msg = '1') THEN
|
2893 |
|
|
tx_bit_xhdl107 := '1';
|
2894 |
|
|
ELSE
|
2895 |
|
|
IF (r_tx_data_0(0) = '1') THEN
|
2896 |
|
|
-- Extended frame
|
2897 |
|
|
|
2898 |
|
|
tx_bit_xhdl107 := extended_chain_ext(conv_integer(tx_pointer));
|
2899 |
|
|
ELSE
|
2900 |
|
|
tx_bit_xhdl107 := extended_chain_std(conv_integer(tx_pointer));
|
2901 |
|
|
END IF;
|
2902 |
|
|
END IF;
|
2903 |
|
|
END IF;
|
2904 |
|
|
END IF;
|
2905 |
|
|
ELSE
|
2906 |
|
|
-- Basic mode
|
2907 |
|
|
|
2908 |
|
|
IF (rx_data = '1') THEN
|
2909 |
|
|
-- data stage
|
2910 |
|
|
|
2911 |
|
|
tx_bit_xhdl107 := basic_chain_data(conv_integer(tx_pointer));
|
2912 |
|
|
ELSE
|
2913 |
|
|
IF (rx_crc = '1') THEN
|
2914 |
|
|
tx_bit_xhdl107 := r_calculated_crc(conv_integer(tx_pointer));
|
2915 |
|
|
ELSE
|
2916 |
|
|
IF (finish_msg = '1') THEN
|
2917 |
|
|
tx_bit_xhdl107 := '1';
|
2918 |
|
|
ELSE
|
2919 |
|
|
tx_bit_xhdl107 := basic_chain(conv_integer(tx_pointer));
|
2920 |
|
|
END IF;
|
2921 |
|
|
END IF;
|
2922 |
|
|
END IF;
|
2923 |
|
|
END IF;
|
2924 |
|
|
tx_bit <= tx_bit_xhdl107;
|
2925 |
|
|
END PROCESS;
|
2926 |
|
|
temp_xhdl108 <= "111111" WHEN tx_data_0(3) = '1' ELSE ((tx_data_0(2 DOWNTO 0) & "000") - 1);
|
2927 |
|
|
limited_tx_cnt_ext <= temp_xhdl108 ;
|
2928 |
|
|
temp_xhdl109 <= "111111" WHEN tx_data_1(3) = '1' ELSE ((tx_data_1(2 DOWNTO 0) & "000") - 1);
|
2929 |
|
|
limited_tx_cnt_std <= temp_xhdl109 ;
|
2930 |
|
|
-- arbitration + control for extended format
|
2931 |
|
|
-- arbitration + control for extended format
|
2932 |
|
|
-- arbitration + control for standard format
|
2933 |
|
|
-- data (overflow is OK here)
|
2934 |
|
|
-- data (overflow is OK here)
|
2935 |
|
|
-- crc
|
2936 |
|
|
-- at the end
|
2937 |
|
|
rst_tx_pointer <= ((((((NOT bit_de_stuff_tx) AND tx_point) AND (NOT rx_data)) AND extended_mode) AND r_tx_data_0(0)) AND CONV_STD_LOGIC(tx_pointer = "100110")) OR ((((((NOT bit_de_stuff_tx) AND tx_point) AND (NOT rx_data)) AND extended_mode) AND (NOT r_tx_data_0(0))) AND CONV_STD_LOGIC(tx_pointer = "010010")) OR (((((NOT bit_de_stuff_tx) AND tx_point) AND (NOT rx_data)) AND (NOT extended_mode)) AND CONV_STD_LOGIC(tx_pointer = "010010")) OR (((((NOT bit_de_stuff_tx) AND tx_point) AND rx_data) AND extended_mode) AND CONV_STD_LOGIC(tx_pointer = limited_tx_cnt_ext)) OR (((((NOT bit_de_stuff_tx) AND tx_point) AND rx_data) AND (NOT extended_mode)) AND CONV_STD_LOGIC(tx_pointer = limited_tx_cnt_std)) OR (tx_point AND rx_crc_lim) OR (go_rx_idle) OR (reset_mode) OR (overload_frame_xhdl4) OR (error_frame) ;
|
2938 |
|
|
|
2939 |
|
|
PROCESS (clk, rst)
|
2940 |
|
|
BEGIN
|
2941 |
|
|
-- IF (rst = '1') THEN
|
2942 |
|
|
-- tx_pointer <= "000000";
|
2943 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2944 |
|
|
IF (rst_tx_pointer = '1') THEN
|
2945 |
|
|
tx_pointer <= "000000" ;
|
2946 |
|
|
ELSE
|
2947 |
|
|
IF ((go_early_tx OR ((tx_point AND (tx_state_xhdl2 OR go_tx_xhdl34)) AND (NOT bit_de_stuff_tx))) = '1') THEN
|
2948 |
|
|
tx_pointer <= tx_pointer + "000001" ;
|
2949 |
|
|
END IF;
|
2950 |
|
|
END IF;
|
2951 |
|
|
IF (rst = '1') THEN
|
2952 |
|
|
tx_pointer <= "000000";
|
2953 |
|
|
END IF;
|
2954 |
|
|
END IF;
|
2955 |
|
|
END PROCESS;
|
2956 |
|
|
tx_successful_xhdl19 <= ((((transmitter_xhdl8 AND go_rx_inter_xhdl9) AND (NOT go_error_frame_xhdl33)) AND (NOT error_frame_ended)) AND (NOT overload_frame_ended)) AND (NOT arbitration_lost) ;
|
2957 |
|
|
|
2958 |
|
|
PROCESS (clk, rst)
|
2959 |
|
|
BEGIN
|
2960 |
|
|
-- IF (rst = '1') THEN
|
2961 |
|
|
-- need_to_tx_xhdl20 <= '0';
|
2962 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2963 |
|
|
IF ((tx_successful_xhdl19 OR reset_mode OR (abort_tx AND (NOT transmitting_xhdl7)) OR (((NOT tx_state_xhdl2) AND tx_state_q_xhdl3) AND single_shot_transmission)) = '1') THEN
|
2964 |
|
|
need_to_tx_xhdl20 <= '0' ;
|
2965 |
|
|
ELSE
|
2966 |
|
|
IF ((tx_request AND sample_point) = '1') THEN
|
2967 |
|
|
need_to_tx_xhdl20 <= '1' ;
|
2968 |
|
|
END IF;
|
2969 |
|
|
END IF;
|
2970 |
|
|
IF (rst = '1') THEN
|
2971 |
|
|
need_to_tx_xhdl20 <= '0';
|
2972 |
|
|
END IF;
|
2973 |
|
|
END IF;
|
2974 |
|
|
END PROCESS;
|
2975 |
|
|
go_early_tx <= ((((((NOT listen_only_mode) AND need_to_tx_xhdl20) AND (NOT tx_state_xhdl2)) AND (NOT suspend OR CONV_STD_LOGIC(susp_cnt = "111"))) AND sample_point) AND (NOT sampled_bit)) AND (rx_idle_xhdl6 OR last_bit_of_inter) ;
|
2976 |
|
|
go_tx_xhdl34 <= ((((NOT listen_only_mode) AND need_to_tx_xhdl20) AND (NOT tx_state_xhdl2)) AND (NOT suspend OR (sample_point AND CONV_STD_LOGIC(susp_cnt = "111")))) AND (go_early_tx OR rx_idle_xhdl6) ;
|
2977 |
|
|
|
2978 |
|
|
-- go_early_tx latched (for proper bit_de_stuff generation)
|
2979 |
|
|
|
2980 |
|
|
PROCESS (clk, rst)
|
2981 |
|
|
BEGIN
|
2982 |
|
|
-- IF (rst = '1') THEN
|
2983 |
|
|
-- go_early_tx_latched <= '0';
|
2984 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
2985 |
|
|
IF ((reset_mode OR tx_point) = '1') THEN
|
2986 |
|
|
go_early_tx_latched <= '0' ;
|
2987 |
|
|
ELSE
|
2988 |
|
|
IF (go_early_tx = '1') THEN
|
2989 |
|
|
go_early_tx_latched <= '1' ;
|
2990 |
|
|
END IF;
|
2991 |
|
|
END IF;
|
2992 |
|
|
IF (rst = '1') THEN
|
2993 |
|
|
go_early_tx_latched <= '0';
|
2994 |
|
|
END IF;
|
2995 |
|
|
END IF;
|
2996 |
|
|
END PROCESS;
|
2997 |
|
|
|
2998 |
|
|
-- Tx state
|
2999 |
|
|
|
3000 |
|
|
PROCESS (clk, rst)
|
3001 |
|
|
BEGIN
|
3002 |
|
|
-- IF (rst = '1') THEN
|
3003 |
|
|
-- tx_state_xhdl2 <= '0';
|
3004 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3005 |
|
|
IF ((reset_mode OR go_rx_inter_xhdl9 OR error_frame OR arbitration_lost) = '1') THEN
|
3006 |
|
|
tx_state_xhdl2 <= '0' ;
|
3007 |
|
|
ELSE
|
3008 |
|
|
IF (go_tx_xhdl34 = '1') THEN
|
3009 |
|
|
tx_state_xhdl2 <= '1' ;
|
3010 |
|
|
END IF;
|
3011 |
|
|
END IF;
|
3012 |
|
|
IF (rst = '1') THEN
|
3013 |
|
|
tx_state_xhdl2 <= '0';
|
3014 |
|
|
END IF;
|
3015 |
|
|
END IF;
|
3016 |
|
|
END PROCESS;
|
3017 |
|
|
|
3018 |
|
|
PROCESS (clk, rst)
|
3019 |
|
|
BEGIN
|
3020 |
|
|
-- IF (rst = '1') THEN
|
3021 |
|
|
-- tx_state_q_xhdl3 <= '0' ;
|
3022 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3023 |
|
|
IF (reset_mode = '1') THEN
|
3024 |
|
|
tx_state_q_xhdl3 <= '0' ;
|
3025 |
|
|
ELSE
|
3026 |
|
|
tx_state_q_xhdl3 <= tx_state_xhdl2 ;
|
3027 |
|
|
END IF;
|
3028 |
|
|
IF (rst = '1') THEN
|
3029 |
|
|
tx_state_q_xhdl3 <= '0' ;
|
3030 |
|
|
END IF;
|
3031 |
|
|
END IF;
|
3032 |
|
|
END PROCESS;
|
3033 |
|
|
|
3034 |
|
|
-- Node is a transmitter
|
3035 |
|
|
|
3036 |
|
|
PROCESS (clk, rst)
|
3037 |
|
|
BEGIN
|
3038 |
|
|
-- IF (rst = '1') THEN
|
3039 |
|
|
-- transmitter_xhdl8 <= '0';
|
3040 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3041 |
|
|
IF (go_tx_xhdl34 = '1') THEN
|
3042 |
|
|
transmitter_xhdl8 <= '1' ;
|
3043 |
|
|
ELSE
|
3044 |
|
|
IF ((reset_mode OR go_rx_idle or (suspend AND go_rx_id1)) = '1') THEN
|
3045 |
|
|
transmitter_xhdl8 <= '0' ;
|
3046 |
|
|
END IF;
|
3047 |
|
|
END IF;
|
3048 |
|
|
IF (rst = '1') THEN
|
3049 |
|
|
transmitter_xhdl8 <= '0';
|
3050 |
|
|
END IF;
|
3051 |
|
|
END IF;
|
3052 |
|
|
END PROCESS;
|
3053 |
|
|
|
3054 |
|
|
-- Signal "transmitting" signals that the core is a transmitting (message, error frame or overload frame). No synchronization is done meanwhile.
|
3055 |
|
|
-- Node might be both transmitter or receiver (sending error or overload frame)
|
3056 |
|
|
|
3057 |
|
|
PROCESS (clk, rst)
|
3058 |
|
|
BEGIN
|
3059 |
|
|
-- IF (rst = '1') THEN
|
3060 |
|
|
-- transmitting_xhdl7 <= '0';
|
3061 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3062 |
|
|
IF ((go_error_frame_xhdl33 OR go_overload_frame_xhdl32 OR go_tx_xhdl34 OR send_ack_xhdl35) = '1') THEN
|
3063 |
|
|
transmitting_xhdl7 <= '1' ;
|
3064 |
|
|
ELSE
|
3065 |
|
|
IF ((reset_mode OR go_rx_idle OR (go_rx_id1 AND (NOT tx_state_xhdl2)) OR (arbitration_lost AND tx_state_xhdl2)) = '1') THEN
|
3066 |
|
|
transmitting_xhdl7 <= '0' ;
|
3067 |
|
|
END IF;
|
3068 |
|
|
END IF;
|
3069 |
|
|
IF (rst = '1') THEN
|
3070 |
|
|
transmitting_xhdl7 <= '0';
|
3071 |
|
|
END IF;
|
3072 |
|
|
END IF;
|
3073 |
|
|
END PROCESS;
|
3074 |
|
|
|
3075 |
|
|
PROCESS (clk, rst)
|
3076 |
|
|
BEGIN
|
3077 |
|
|
-- IF (rst = '1') THEN
|
3078 |
|
|
-- suspend <= '0';
|
3079 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3080 |
|
|
IF ((reset_mode OR (sample_point AND CONV_STD_LOGIC(susp_cnt = "111"))) = '1') THEN
|
3081 |
|
|
suspend <= '0' ;
|
3082 |
|
|
ELSE
|
3083 |
|
|
IF (((not_first_bit_of_inter_xhdl10 AND transmitter_xhdl8) AND node_error_passive_xhdl26) = '1') THEN
|
3084 |
|
|
suspend <= '1' ;
|
3085 |
|
|
END IF;
|
3086 |
|
|
END IF;
|
3087 |
|
|
IF (rst = '1') THEN
|
3088 |
|
|
suspend <= '0';
|
3089 |
|
|
END IF;
|
3090 |
|
|
END IF;
|
3091 |
|
|
END PROCESS;
|
3092 |
|
|
|
3093 |
|
|
PROCESS (clk, rst)
|
3094 |
|
|
BEGIN
|
3095 |
|
|
-- IF (rst = '1') THEN
|
3096 |
|
|
-- susp_cnt_en <= '0';
|
3097 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3098 |
|
|
IF ((reset_mode OR (sample_point AND CONV_STD_LOGIC(susp_cnt = "111"))) = '1') THEN
|
3099 |
|
|
susp_cnt_en <= '0' ;
|
3100 |
|
|
ELSE
|
3101 |
|
|
IF (((suspend AND sample_point) AND last_bit_of_inter) = '1') THEN
|
3102 |
|
|
susp_cnt_en <= '1' ;
|
3103 |
|
|
END IF;
|
3104 |
|
|
END IF;
|
3105 |
|
|
IF (rst = '1') THEN
|
3106 |
|
|
susp_cnt_en <= '0';
|
3107 |
|
|
END IF;
|
3108 |
|
|
END IF;
|
3109 |
|
|
END PROCESS;
|
3110 |
|
|
|
3111 |
|
|
PROCESS (clk, rst)
|
3112 |
|
|
BEGIN
|
3113 |
|
|
-- IF (rst = '1') THEN
|
3114 |
|
|
-- susp_cnt <= "000";
|
3115 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3116 |
|
|
IF ((reset_mode OR (sample_point AND CONV_STD_LOGIC(susp_cnt = "111"))) = '1') THEN
|
3117 |
|
|
susp_cnt <= "000" ;
|
3118 |
|
|
ELSE
|
3119 |
|
|
IF ((susp_cnt_en AND sample_point) = '1') THEN
|
3120 |
|
|
susp_cnt <= susp_cnt + "001" ;
|
3121 |
|
|
END IF;
|
3122 |
|
|
END IF;
|
3123 |
|
|
IF (rst = '1') THEN
|
3124 |
|
|
susp_cnt <= "000";
|
3125 |
|
|
END IF;
|
3126 |
|
|
END IF;
|
3127 |
|
|
END PROCESS;
|
3128 |
|
|
|
3129 |
|
|
PROCESS (clk, rst)
|
3130 |
|
|
BEGIN
|
3131 |
|
|
-- IF (rst = '1') THEN
|
3132 |
|
|
-- finish_msg <= '0';
|
3133 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3134 |
|
|
IF ((go_rx_idle OR go_rx_id1 OR error_frame OR reset_mode) = '1') THEN
|
3135 |
|
|
finish_msg <= '0' ;
|
3136 |
|
|
ELSE
|
3137 |
|
|
IF (go_rx_crc_lim = '1') THEN
|
3138 |
|
|
finish_msg <= '1' ;
|
3139 |
|
|
END IF;
|
3140 |
|
|
END IF;
|
3141 |
|
|
IF (rst = '1') THEN
|
3142 |
|
|
finish_msg <= '0';
|
3143 |
|
|
END IF;
|
3144 |
|
|
END IF;
|
3145 |
|
|
END PROCESS;
|
3146 |
|
|
|
3147 |
|
|
PROCESS (clk, rst)
|
3148 |
|
|
BEGIN
|
3149 |
|
|
-- IF (rst = '1') THEN
|
3150 |
|
|
-- arbitration_lost <= '0';
|
3151 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3152 |
|
|
IF ((go_rx_idle OR error_frame_ended OR reset_mode) = '1') THEN
|
3153 |
|
|
arbitration_lost <= '0' ;
|
3154 |
|
|
ELSE
|
3155 |
|
|
IF (((((transmitter_xhdl8 AND sample_point) AND tx_xhdl29) AND arbitration_field) AND NOT sampled_bit) = '1') THEN
|
3156 |
|
|
arbitration_lost <= '1' ;
|
3157 |
|
|
END IF;
|
3158 |
|
|
END IF;
|
3159 |
|
|
IF (rst = '1') THEN
|
3160 |
|
|
arbitration_lost <= '0';
|
3161 |
|
|
END IF;
|
3162 |
|
|
END IF;
|
3163 |
|
|
END PROCESS;
|
3164 |
|
|
|
3165 |
|
|
PROCESS (clk, rst)
|
3166 |
|
|
BEGIN
|
3167 |
|
|
-- IF (rst = '1') THEN
|
3168 |
|
|
-- arbitration_lost_q <= '0' ;
|
3169 |
|
|
-- read_arbitration_lost_capture_reg_q <= '0';
|
3170 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3171 |
|
|
IF (reset_mode = '1') THEN
|
3172 |
|
|
arbitration_lost_q <= '0';
|
3173 |
|
|
read_arbitration_lost_capture_reg_q <= '0';
|
3174 |
|
|
ELSE
|
3175 |
|
|
arbitration_lost_q <= arbitration_lost;
|
3176 |
|
|
read_arbitration_lost_capture_reg_q <= read_arbitration_lost_capture_reg ;
|
3177 |
|
|
END IF;
|
3178 |
|
|
IF (rst = '1') THEN
|
3179 |
|
|
arbitration_lost_q <= '0' ;
|
3180 |
|
|
read_arbitration_lost_capture_reg_q <= '0';
|
3181 |
|
|
END IF;
|
3182 |
|
|
END IF;
|
3183 |
|
|
END PROCESS;
|
3184 |
|
|
set_arbitration_lost_irq_xhdl24 <= (arbitration_lost AND (NOT arbitration_lost_q)) AND (NOT arbitration_blocked) ;
|
3185 |
|
|
|
3186 |
|
|
PROCESS (clk, rst)
|
3187 |
|
|
BEGIN
|
3188 |
|
|
-- IF (rst = '1') THEN
|
3189 |
|
|
-- read_error_code_capture_reg_q <= '0';
|
3190 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3191 |
|
|
read_error_code_capture_reg_q <= read_error_code_capture_reg;
|
3192 |
|
|
IF (rst = '1') THEN
|
3193 |
|
|
read_error_code_capture_reg_q <= '0';
|
3194 |
|
|
END IF;
|
3195 |
|
|
END IF;
|
3196 |
|
|
END PROCESS;
|
3197 |
|
|
|
3198 |
|
|
reset_error_code_capture_reg <= read_error_code_capture_reg_q and not read_error_code_capture_reg;
|
3199 |
|
|
|
3200 |
|
|
PROCESS (clk, rst)
|
3201 |
|
|
BEGIN
|
3202 |
|
|
-- IF (rst = '1') THEN
|
3203 |
|
|
-- arbitration_cnt_en <= '0';
|
3204 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3205 |
|
|
IF ((reset_mode OR arbitration_blocked) = '1') THEN
|
3206 |
|
|
arbitration_cnt_en <= '0' ;
|
3207 |
|
|
ELSE
|
3208 |
|
|
IF (((rx_id1 AND sample_point) AND (NOT arbitration_blocked)) = '1') THEN
|
3209 |
|
|
arbitration_cnt_en <= '1' ;
|
3210 |
|
|
END IF;
|
3211 |
|
|
END IF;
|
3212 |
|
|
IF (rst = '1') THEN
|
3213 |
|
|
arbitration_cnt_en <= '0';
|
3214 |
|
|
END IF;
|
3215 |
|
|
END IF;
|
3216 |
|
|
END PROCESS;
|
3217 |
|
|
|
3218 |
|
|
PROCESS (clk, rst)
|
3219 |
|
|
BEGIN
|
3220 |
|
|
-- IF (rst = '1') THEN
|
3221 |
|
|
-- arbitration_blocked <= '0';
|
3222 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3223 |
|
|
IF ((reset_mode OR read_arbitration_lost_capture_reg) = '1') THEN
|
3224 |
|
|
arbitration_blocked <= '0' ;
|
3225 |
|
|
ELSE
|
3226 |
|
|
IF (set_arbitration_lost_irq_xhdl24 = '1') THEN
|
3227 |
|
|
arbitration_blocked <= '1' ;
|
3228 |
|
|
END IF;
|
3229 |
|
|
END IF;
|
3230 |
|
|
IF (rst = '1') THEN
|
3231 |
|
|
arbitration_blocked <= '0';
|
3232 |
|
|
END IF;
|
3233 |
|
|
END IF;
|
3234 |
|
|
END PROCESS;
|
3235 |
|
|
|
3236 |
|
|
PROCESS (clk, rst)
|
3237 |
|
|
BEGIN
|
3238 |
|
|
-- IF (rst = '1') THEN
|
3239 |
|
|
-- arbitration_lost_capture_xhdl25 <= "00000";
|
3240 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3241 |
|
|
IF (read_arbitration_lost_capture_reg_q = '1') THEN
|
3242 |
|
|
arbitration_lost_capture_xhdl25 <= "00000" ;
|
3243 |
|
|
ELSE
|
3244 |
|
|
IF ((((sample_point AND (NOT arbitration_blocked)) AND arbitration_cnt_en) AND (NOT bit_de_stuff)) = '1') THEN
|
3245 |
|
|
arbitration_lost_capture_xhdl25 <= arbitration_lost_capture_xhdl25 + "00001" ;
|
3246 |
|
|
END IF;
|
3247 |
|
|
END IF;
|
3248 |
|
|
IF (rst = '1') THEN
|
3249 |
|
|
arbitration_lost_capture_xhdl25 <= "00000";
|
3250 |
|
|
END IF;
|
3251 |
|
|
END IF;
|
3252 |
|
|
END PROCESS;
|
3253 |
|
|
|
3254 |
|
|
PROCESS (clk, rst)
|
3255 |
|
|
BEGIN
|
3256 |
|
|
-- IF (rst = '1') THEN
|
3257 |
|
|
-- rx_err_cnt_xhdl15 <= "000000000";
|
3258 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3259 |
|
|
IF (set_reset_mode_xhdl12 = '1') THEN
|
3260 |
|
|
rx_err_cnt_xhdl15 <= "000000000" ;
|
3261 |
|
|
else
|
3262 |
|
|
IF (((NOT listen_only_mode) AND (NOT transmitter_xhdl8 OR arbitration_lost)) = '1') THEN
|
3263 |
|
|
IF ((((go_rx_ack_lim AND (NOT go_error_frame_xhdl33)) AND (NOT crc_err)) AND CONV_STD_LOGIC(rx_err_cnt_xhdl15 > "000000000")) = '1') THEN
|
3264 |
|
|
IF (rx_err_cnt_xhdl15 > "001111111") THEN
|
3265 |
|
|
rx_err_cnt_xhdl15 <= "001111111" ;
|
3266 |
|
|
ELSE
|
3267 |
|
|
rx_err_cnt_xhdl15 <= rx_err_cnt_xhdl15 - "000000001" ;
|
3268 |
|
|
END IF;
|
3269 |
|
|
ELSE
|
3270 |
|
|
IF (rx_err_cnt_xhdl15 < "010000000") THEN
|
3271 |
|
|
IF ((go_error_frame_xhdl33 AND (NOT rule5)) = '1') THEN
|
3272 |
|
|
-- 1 (rule 5 is just the opposite then rule 1 exception
|
3273 |
|
|
|
3274 |
|
|
rx_err_cnt_xhdl15 <= rx_err_cnt_xhdl15 + "000000001" ;
|
3275 |
|
|
ELSE
|
3276 |
|
|
IF ((((((error_flag_over AND (NOT error_flag_over_latched)) AND sample_point) AND (NOT sampled_bit)) AND CONV_STD_LOGIC(error_cnt1 = "111")) OR (go_error_frame_xhdl33 AND rule5) OR ((sample_point AND (NOT sampled_bit)) AND CONV_STD_LOGIC(delayed_dominant_cnt = "111"))) = '1') THEN
|
3277 |
|
|
-- 2
|
3278 |
|
|
-- 5
|
3279 |
|
|
-- 6
|
3280 |
|
|
|
3281 |
|
|
rx_err_cnt_xhdl15 <= rx_err_cnt_xhdl15 + "000001000" ;
|
3282 |
|
|
END IF;
|
3283 |
|
|
END IF;
|
3284 |
|
|
END IF;
|
3285 |
|
|
END IF;
|
3286 |
|
|
END IF;
|
3287 |
|
|
end if;
|
3288 |
|
|
IF (rst = '1') THEN
|
3289 |
|
|
rx_err_cnt_xhdl15 <= "000000000";
|
3290 |
|
|
END IF;
|
3291 |
|
|
END IF;
|
3292 |
|
|
END PROCESS;
|
3293 |
|
|
|
3294 |
|
|
PROCESS (clk, rst)
|
3295 |
|
|
BEGIN
|
3296 |
|
|
-- IF (rst = '1') THEN
|
3297 |
|
|
-- tx_err_cnt_xhdl16 <= "000000000";
|
3298 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3299 |
|
|
IF (set_reset_mode_xhdl12 = '1') THEN
|
3300 |
|
|
tx_err_cnt_xhdl16 <= "010000000" ;
|
3301 |
|
|
ELSE
|
3302 |
|
|
IF ((CONV_STD_LOGIC(tx_err_cnt_xhdl16 > "000000000") AND (tx_successful_xhdl19 OR bus_free)) = '1') THEN
|
3303 |
|
|
tx_err_cnt_xhdl16 <= tx_err_cnt_xhdl16 - "000000001" ;
|
3304 |
|
|
ELSE
|
3305 |
|
|
IF ((transmitter_xhdl8 AND (NOT arbitration_lost)) = '1') THEN
|
3306 |
|
|
IF ((((sample_point AND (NOT sampled_bit)) AND CONV_STD_LOGIC(delayed_dominant_cnt = "111")) OR (go_error_frame_xhdl33 AND rule5) OR ((go_error_frame_xhdl33 AND (NOT ((transmitter_xhdl8 AND node_error_passive_xhdl26) AND ack_err))) AND (NOT (((((transmitter_xhdl8 AND stuff_err) AND arbitration_field) AND sample_point) AND tx_xhdl29) AND (NOT sampled_bit)))) OR (error_frame AND rule3_exc1_2)) = '1') THEN
|
3307 |
|
|
-- 6
|
3308 |
|
|
-- 4 (rule 5 is the same as rule 4)
|
3309 |
|
|
-- 3
|
3310 |
|
|
-- 3
|
3311 |
|
|
|
3312 |
|
|
tx_err_cnt_xhdl16 <= tx_err_cnt_xhdl16 + "000001000" ;
|
3313 |
|
|
END IF;
|
3314 |
|
|
END IF;
|
3315 |
|
|
END IF;
|
3316 |
|
|
end if;
|
3317 |
|
|
IF (rst = '1') THEN
|
3318 |
|
|
tx_err_cnt_xhdl16 <= "000000000";
|
3319 |
|
|
END IF;
|
3320 |
|
|
END IF;
|
3321 |
|
|
END PROCESS;
|
3322 |
|
|
|
3323 |
|
|
set_reset_mode_xhdl12 <= node_bus_off_xhdl13 AND (NOT node_bus_off_q) ; --##
|
3324 |
|
|
|
3325 |
|
|
PROCESS (clk, rst)
|
3326 |
|
|
BEGIN
|
3327 |
|
|
-- IF (rst = '1') THEN
|
3328 |
|
|
-- node_error_passive_xhdl26 <= '0';
|
3329 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3330 |
|
|
IF ((rx_err_cnt_xhdl15 < "010000000") AND (tx_err_cnt_xhdl16 < "010000000")) THEN
|
3331 |
|
|
node_error_passive_xhdl26 <= '0' ;
|
3332 |
|
|
ELSE
|
3333 |
|
|
IF (((CONV_STD_LOGIC((rx_err_cnt_xhdl15 >= "010000000") OR (tx_err_cnt_xhdl16 >= "010000000")) AND (error_frame_ended OR go_error_frame_xhdl33 OR ((NOT reset_mode) AND reset_mode_q))) AND (NOT node_bus_off_xhdl13)) = '1') THEN
|
3334 |
|
|
node_error_passive_xhdl26 <= '1' ;
|
3335 |
|
|
END IF;
|
3336 |
|
|
END IF;
|
3337 |
|
|
IF (rst = '1') THEN
|
3338 |
|
|
node_error_passive_xhdl26 <= '0';
|
3339 |
|
|
END IF;
|
3340 |
|
|
END IF;
|
3341 |
|
|
END PROCESS;
|
3342 |
|
|
node_error_active_xhdl27 <= NOT (node_error_passive_xhdl26 OR node_bus_off_xhdl13) ;
|
3343 |
|
|
|
3344 |
|
|
PROCESS (clk, rst)
|
3345 |
|
|
BEGIN
|
3346 |
|
|
-- IF (rst = '1') THEN
|
3347 |
|
|
-- node_bus_off_xhdl13 <= '0';
|
3348 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3349 |
|
|
IF ( (CONV_STD_LOGIC((rx_err_cnt_xhdl15 = "000000000") AND (tx_err_cnt_xhdl16 = "000000000")) AND (NOT reset_mode)) = '1' or restart = '1') THEN
|
3350 |
|
|
node_bus_off_xhdl13 <= '0' ;
|
3351 |
|
|
ELSE
|
3352 |
|
|
IF (CONV_STD_LOGIC(tx_err_cnt_xhdl16 >= "100000000") = '1') THEN
|
3353 |
|
|
node_bus_off_xhdl13 <= '1' ;
|
3354 |
|
|
END IF;
|
3355 |
|
|
END IF;
|
3356 |
|
|
IF (rst = '1') THEN
|
3357 |
|
|
node_bus_off_xhdl13 <= '0';
|
3358 |
|
|
END IF;
|
3359 |
|
|
END IF;
|
3360 |
|
|
END PROCESS;
|
3361 |
|
|
|
3362 |
|
|
PROCESS (clk, rst)
|
3363 |
|
|
BEGIN
|
3364 |
|
|
-- IF (rst = '1') THEN
|
3365 |
|
|
-- bus_free_cnt <= "0000";
|
3366 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3367 |
|
|
IF (reset_mode = '1') THEN
|
3368 |
|
|
bus_free_cnt <= "0000" ;
|
3369 |
|
|
ELSE
|
3370 |
|
|
IF (sample_point = '1') THEN
|
3371 |
|
|
IF (((sampled_bit AND bus_free_cnt_en) AND CONV_STD_LOGIC(bus_free_cnt < "1010")) = '1') THEN
|
3372 |
|
|
bus_free_cnt <= bus_free_cnt + "0001" ;
|
3373 |
|
|
ELSE
|
3374 |
|
|
bus_free_cnt <= "0000" ;
|
3375 |
|
|
END IF;
|
3376 |
|
|
END IF;
|
3377 |
|
|
END IF;
|
3378 |
|
|
IF (rst = '1') THEN
|
3379 |
|
|
bus_free_cnt <= "0000";
|
3380 |
|
|
END IF;
|
3381 |
|
|
END IF;
|
3382 |
|
|
END PROCESS;
|
3383 |
|
|
|
3384 |
|
|
PROCESS (clk, rst)
|
3385 |
|
|
BEGIN
|
3386 |
|
|
-- IF (rst = '1') THEN
|
3387 |
|
|
-- bus_free_cnt_en <= '0';
|
3388 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3389 |
|
|
IF ((((NOT reset_mode) AND reset_mode_q) OR (node_bus_off_q AND (NOT reset_mode))) = '1') THEN
|
3390 |
|
|
bus_free_cnt_en <= '1' ;
|
3391 |
|
|
ELSE
|
3392 |
|
|
IF ((((sample_point AND sampled_bit) AND CONV_STD_LOGIC(bus_free_cnt = "1010")) AND (NOT node_bus_off_xhdl13)) = '1') THEN
|
3393 |
|
|
bus_free_cnt_en <= '0' ;
|
3394 |
|
|
END IF;
|
3395 |
|
|
END IF;
|
3396 |
|
|
IF (rst = '1') THEN
|
3397 |
|
|
bus_free_cnt_en <= '1';
|
3398 |
|
|
END IF;
|
3399 |
|
|
END IF;
|
3400 |
|
|
END PROCESS;
|
3401 |
|
|
|
3402 |
|
|
PROCESS (clk, rst)
|
3403 |
|
|
BEGIN
|
3404 |
|
|
-- IF (rst = '1') THEN
|
3405 |
|
|
-- bus_free <= '0';
|
3406 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3407 |
|
|
IF (reset_mode = '1') THEN
|
3408 |
|
|
bus_free <= '0';
|
3409 |
|
|
ELSE
|
3410 |
|
|
IF (((sample_point AND sampled_bit) AND CONV_STD_LOGIC(bus_free_cnt = "1010")) = '1') THEN
|
3411 |
|
|
bus_free <= '1' ;
|
3412 |
|
|
ELSE
|
3413 |
|
|
bus_free <= '0' ;
|
3414 |
|
|
END IF;
|
3415 |
|
|
END IF;
|
3416 |
|
|
IF (rst = '1') THEN
|
3417 |
|
|
bus_free <= '0';
|
3418 |
|
|
END IF;
|
3419 |
|
|
END IF;
|
3420 |
|
|
END PROCESS;
|
3421 |
|
|
|
3422 |
|
|
PROCESS (clk, rst)
|
3423 |
|
|
BEGIN
|
3424 |
|
|
-- IF (rst = '1') THEN
|
3425 |
|
|
-- waiting_for_bus_free <= '1';
|
3426 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3427 |
|
|
IF (reset_mode = '1') THEN
|
3428 |
|
|
waiting_for_bus_free <= '1';
|
3429 |
|
|
ELSE
|
3430 |
|
|
IF ((bus_free AND (NOT node_bus_off_xhdl13)) = '1') THEN
|
3431 |
|
|
waiting_for_bus_free <= '0' ;
|
3432 |
|
|
ELSE
|
3433 |
|
|
IF ((((NOT reset_mode) AND reset_mode_q) OR (node_bus_off_q AND (NOT reset_mode))) = '1') THEN
|
3434 |
|
|
waiting_for_bus_free <= '1' ;
|
3435 |
|
|
END IF;
|
3436 |
|
|
END IF;
|
3437 |
|
|
END IF;
|
3438 |
|
|
IF (rst = '1') THEN
|
3439 |
|
|
waiting_for_bus_free <= '1';
|
3440 |
|
|
END IF;
|
3441 |
|
|
END IF;
|
3442 |
|
|
END PROCESS;
|
3443 |
|
|
transmit_status_xhdl17 <= transmitting_xhdl7 OR (extended_mode AND waiting_for_bus_free) ;
|
3444 |
|
|
temp_xhdl111 <= (waiting_for_bus_free OR ((NOT rx_idle_xhdl6) AND (NOT transmitting_xhdl7))) WHEN extended_mode = '1' ELSE (((NOT waiting_for_bus_free) AND (NOT rx_idle_xhdl6)) AND (NOT transmitting_xhdl7));
|
3445 |
|
|
receive_status_xhdl18 <= temp_xhdl111 ;
|
3446 |
|
|
|
3447 |
|
|
-- Error code capture register
|
3448 |
|
|
PROCESS (clk, rst)
|
3449 |
|
|
BEGIN
|
3450 |
|
|
-- IF (rst = '1') THEN
|
3451 |
|
|
-- error_capture_code_xhdl5 <= "00000000";
|
3452 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3453 |
|
|
IF (reset_error_code_capture_reg = '1') THEN
|
3454 |
|
|
error_capture_code_xhdl5 <= "00000000" ;
|
3455 |
|
|
ELSE
|
3456 |
|
|
IF (set_bus_error_irq_xhdl23 = '1') THEN
|
3457 |
|
|
error_capture_code_xhdl5 <= error_capture_code_type(7 DOWNTO 6) & error_capture_code_direction & error_capture_code_segment(4 DOWNTO 0) ;
|
3458 |
|
|
END IF;
|
3459 |
|
|
END IF;
|
3460 |
|
|
IF (rst = '1') THEN
|
3461 |
|
|
error_capture_code_xhdl5 <= "00000000";
|
3462 |
|
|
END IF;
|
3463 |
|
|
END IF;
|
3464 |
|
|
END PROCESS;
|
3465 |
|
|
error_capture_code_segment(0) <= rx_idle_xhdl6 OR rx_ide OR (rx_id2 AND CONV_STD_LOGIC(bit_cnt < "001101")) OR rx_r1 OR rx_r0 OR rx_dlc OR rx_ack OR rx_ack_lim OR (error_frame AND node_error_active_xhdl27) ;
|
3466 |
|
|
error_capture_code_segment(1) <= rx_idle_xhdl6 OR rx_id1 OR rx_id2 OR rx_dlc OR rx_data OR rx_ack_lim OR rx_eof OR rx_inter_xhdl11 OR (error_frame AND node_error_passive_xhdl26) ;
|
3467 |
|
|
error_capture_code_segment(2) <= (rx_id1 AND CONV_STD_LOGIC(bit_cnt > "000111")) OR rx_rtr1 OR rx_ide OR rx_id2 OR rx_rtr2 OR rx_r1 OR (error_frame AND node_error_passive_xhdl26) OR overload_frame_xhdl4 ;
|
3468 |
|
|
error_capture_code_segment(3) <= (rx_id2 AND CONV_STD_LOGIC(bit_cnt > "000100")) OR rx_rtr2 OR rx_r1 OR rx_r0 OR rx_dlc OR rx_data OR rx_crc OR rx_crc_lim OR rx_ack OR rx_ack_lim OR rx_eof OR overload_frame_xhdl4 ;
|
3469 |
|
|
error_capture_code_segment(4) <= rx_crc_lim OR rx_ack OR rx_ack_lim OR rx_eof OR rx_inter_xhdl11 OR error_frame OR overload_frame_xhdl4 ;
|
3470 |
|
|
error_capture_code_direction <= NOT transmitting_xhdl7 ;
|
3471 |
|
|
|
3472 |
|
|
PROCESS (bit_err, form_err, stuff_err)
|
3473 |
|
|
VARIABLE error_capture_code_type_xhdl112 : std_logic_vector(7 DOWNTO 6);
|
3474 |
|
|
BEGIN
|
3475 |
|
|
IF (bit_err = '1') THEN
|
3476 |
|
|
error_capture_code_type_xhdl112(7 DOWNTO 6) := "00";
|
3477 |
|
|
ELSE
|
3478 |
|
|
IF (form_err = '1') THEN
|
3479 |
|
|
error_capture_code_type_xhdl112(7 DOWNTO 6) := "01";
|
3480 |
|
|
ELSE
|
3481 |
|
|
IF (stuff_err = '1') THEN
|
3482 |
|
|
error_capture_code_type_xhdl112(7 DOWNTO 6) := "10";
|
3483 |
|
|
ELSE
|
3484 |
|
|
error_capture_code_type_xhdl112(7 DOWNTO 6) := "11";
|
3485 |
|
|
END IF;
|
3486 |
|
|
END IF;
|
3487 |
|
|
END IF;
|
3488 |
|
|
error_capture_code_type <= error_capture_code_type_xhdl112;
|
3489 |
|
|
END PROCESS;
|
3490 |
|
|
set_bus_error_irq_xhdl23 <= go_error_frame_xhdl33 AND (NOT error_capture_code_blocked) ;
|
3491 |
|
|
|
3492 |
|
|
PROCESS (clk, rst)
|
3493 |
|
|
BEGIN
|
3494 |
|
|
-- IF (rst = '1') THEN
|
3495 |
|
|
-- error_capture_code_blocked <= '0';
|
3496 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
3497 |
|
|
IF (read_error_code_capture_reg = '1') THEN
|
3498 |
|
|
error_capture_code_blocked <= '0' ;
|
3499 |
|
|
ELSE
|
3500 |
|
|
IF (set_bus_error_irq_xhdl23 = '1') THEN
|
3501 |
|
|
error_capture_code_blocked <= '1' ;
|
3502 |
|
|
END IF;
|
3503 |
|
|
END IF;
|
3504 |
|
|
IF (rst = '1') THEN
|
3505 |
|
|
error_capture_code_blocked <= '0';
|
3506 |
|
|
END IF;
|
3507 |
|
|
END IF;
|
3508 |
|
|
END PROCESS;
|
3509 |
|
|
|
3510 |
|
|
END ARCHITECTURE RTL;
|
3511 |
|
|
|
3512 |
|
|
----------------------------------------------------------------------------------------------
|
3513 |
|
|
--
|
3514 |
|
|
-- VHDL file generated by X-HDL - Revision 3.2.53 Aug. 1, 2005
|
3515 |
|
|
-- Tue Aug 9 07:33:50 2005
|
3516 |
|
|
--
|
3517 |
|
|
-- Input file : C:/Documents and Settings/BryantI/My Documents/tmp/can_top.v
|
3518 |
|
|
-- Design name : can_top
|
3519 |
|
|
-- Author :
|
3520 |
|
|
-- Company : Actel
|
3521 |
|
|
--
|
3522 |
|
|
-- Description :
|
3523 |
|
|
--
|
3524 |
|
|
--
|
3525 |
|
|
----------------------------------------------------------------------------------------------
|
3526 |
|
|
--
|
3527 |
|
|
--////////////////////////////////////////////////////////////////////
|
3528 |
|
|
--// ////
|
3529 |
|
|
--// can_top.v ////
|
3530 |
|
|
--// ////
|
3531 |
|
|
--// ////
|
3532 |
|
|
--// This file is part of the CAN Protocol Controller ////
|
3533 |
|
|
--// http://www.opencores.org/projects/can/ ////
|
3534 |
|
|
--// ////
|
3535 |
|
|
--// ////
|
3536 |
|
|
--// Author(s): ////
|
3537 |
|
|
--// Igor Mohor ////
|
3538 |
|
|
--// igorm@opencores.org ////
|
3539 |
|
|
--// ////
|
3540 |
|
|
--// ////
|
3541 |
|
|
--// All additional information is available in the README.txt ////
|
3542 |
|
|
--// file. ////
|
3543 |
|
|
--// ////
|
3544 |
|
|
--////////////////////////////////////////////////////////////////////
|
3545 |
|
|
--// ////
|
3546 |
|
|
--// Copyright (C) 2002, 2003, 2004 Authors ////
|
3547 |
|
|
--// ////
|
3548 |
|
|
--// This source file may be used and distributed without ////
|
3549 |
|
|
--// restriction provided that this copyright statement is not ////
|
3550 |
|
|
--// removed from the file and that any derivative work contains ////
|
3551 |
|
|
--// the original copyright notice and the associated disclaimer. ////
|
3552 |
|
|
--// ////
|
3553 |
|
|
--// This source file is free software; you can redistribute it ////
|
3554 |
|
|
--// and/or modify it under the terms of the GNU Lesser General ////
|
3555 |
|
|
--// Public License as published by the Free Software Foundation; ////
|
3556 |
|
|
--// either version 2.1 of the License, or (at your option) any ////
|
3557 |
|
|
--// later version. ////
|
3558 |
|
|
--// ////
|
3559 |
|
|
--// This source is distributed in the hope that it will be ////
|
3560 |
|
|
--// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
3561 |
|
|
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
3562 |
|
|
--// PURPOSE. See the GNU Lesser General Public License for more ////
|
3563 |
|
|
--// details. ////
|
3564 |
|
|
--// ////
|
3565 |
|
|
--// You should have received a copy of the GNU Lesser General ////
|
3566 |
|
|
--// Public License along with this source; if not, download it ////
|
3567 |
|
|
--// from http://www.opencores.org/lgpl.shtml ////
|
3568 |
|
|
--// ////
|
3569 |
|
|
--// The CAN protocol is developed by Robert Bosch GmbH and ////
|
3570 |
|
|
--// protected by patents. Anybody who wants to implement this ////
|
3571 |
|
|
--// CAN IP core on silicon has to obtain a CAN protocol license ////
|
3572 |
|
|
--// from Bosch. ////
|
3573 |
|
|
--// ////
|
3574 |
|
|
--////////////////////////////////////////////////////////////////////
|
3575 |
|
|
--
|
3576 |
|
|
-- CVS Revision History
|
3577 |
|
|
--
|
3578 |
|
|
-- $Log: can_top.v,v $
|
3579 |
|
|
-- Revision 1.48 2004/10/25 11:44:47 igorm
|
3580 |
|
|
-- Interrupt is always cleared for one clock after the irq register is read.
|
3581 |
|
|
-- This fixes problems when CPU is using IRQs that are edge triggered.
|
3582 |
|
|
--
|
3583 |
|
|
-- Revision 1.47 2004/02/08 14:53:54 mohor
|
3584 |
|
|
-- Header changed. Address latched to posedge. bus_off_on signal added.
|
3585 |
|
|
--
|
3586 |
|
|
-- Revision 1.46 2003/10/17 05:55:20 markom
|
3587 |
|
|
-- mbist signals updated according to newest convention
|
3588 |
|
|
--
|
3589 |
|
|
-- Revision 1.45 2003/09/30 00:55:13 mohor
|
3590 |
|
|
-- Error counters fixed to be compatible with Bosch VHDL reference model.
|
3591 |
|
|
-- Small synchronization changes.
|
3592 |
|
|
--
|
3593 |
|
|
-- Revision 1.44 2003/09/25 18:55:49 mohor
|
3594 |
|
|
-- Synchronization changed, error counters fixed.
|
3595 |
|
|
--
|
3596 |
|
|
-- Revision 1.43 2003/08/20 09:57:39 mohor
|
3597 |
|
|
-- Tristate signal tx_o is separated to tx_o and tx_oen_o. Both signals need
|
3598 |
|
|
-- to be joined together on higher level.
|
3599 |
|
|
--
|
3600 |
|
|
-- Revision 1.42 2003/07/16 15:11:28 mohor
|
3601 |
|
|
-- Fixed according to the linter.
|
3602 |
|
|
--
|
3603 |
|
|
-- Revision 1.41 2003/07/10 15:32:27 mohor
|
3604 |
|
|
-- Unused signal removed.
|
3605 |
|
|
--
|
3606 |
|
|
-- Revision 1.40 2003/07/10 01:59:04 tadejm
|
3607 |
|
|
-- Synchronization fixed. In some strange cases it didn't work according to
|
3608 |
|
|
-- the VHDL reference model.
|
3609 |
|
|
--
|
3610 |
|
|
-- Revision 1.39 2003/07/07 11:21:37 mohor
|
3611 |
|
|
-- Little fixes (to fix warnings).
|
3612 |
|
|
--
|
3613 |
|
|
-- Revision 1.38 2003/07/03 09:32:20 mohor
|
3614 |
|
|
-- Synchronization changed.
|
3615 |
|
|
--
|
3616 |
|
|
-- Revision 1.37 2003/06/27 20:56:15 simons
|
3617 |
|
|
-- Virtual silicon ram instances added.
|
3618 |
|
|
--
|
3619 |
|
|
-- Revision 1.36 2003/06/17 14:30:30 mohor
|
3620 |
|
|
-- "chip select" signal cs_can_i is used only when not using WISHBONE
|
3621 |
|
|
-- interface.
|
3622 |
|
|
--
|
3623 |
|
|
-- Revision 1.35 2003/06/16 13:57:58 mohor
|
3624 |
|
|
-- tx_point generated one clk earlier. rx_i registered. Data corrected when
|
3625 |
|
|
-- using extended mode.
|
3626 |
|
|
--
|
3627 |
|
|
-- Revision 1.34 2003/06/13 15:02:24 mohor
|
3628 |
|
|
-- Synchronization is also needed when transmitting a message.
|
3629 |
|
|
--
|
3630 |
|
|
-- Revision 1.33 2003/06/11 14:21:35 mohor
|
3631 |
|
|
-- When switching to tx, sync stage is overjumped.
|
3632 |
|
|
--
|
3633 |
|
|
-- Revision 1.32 2003/06/09 11:32:36 mohor
|
3634 |
|
|
-- Ports added for the CAN_BIST.
|
3635 |
|
|
--
|
3636 |
|
|
-- Revision 1.31 2003/03/26 11:19:46 mohor
|
3637 |
|
|
-- CAN interrupt is active low.
|
3638 |
|
|
--
|
3639 |
|
|
-- Revision 1.30 2003/03/20 17:01:17 mohor
|
3640 |
|
|
-- unix.
|
3641 |
|
|
--
|
3642 |
|
|
-- Revision 1.28 2003/03/14 19:36:48 mohor
|
3643 |
|
|
-- can_cs signal used for generation of the cs.
|
3644 |
|
|
--
|
3645 |
|
|
-- Revision 1.27 2003/03/12 05:56:33 mohor
|
3646 |
|
|
-- Bidirectional port_0_i changed to port_0_io.
|
3647 |
|
|
-- input cs_can changed to cs_can_i.
|
3648 |
|
|
--
|
3649 |
|
|
-- Revision 1.26 2003/03/12 04:39:40 mohor
|
3650 |
|
|
-- rd_i and wr_i are active high signals. If 8051 is connected, these two signals
|
3651 |
|
|
-- need to be negated one level higher.
|
3652 |
|
|
--
|
3653 |
|
|
-- Revision 1.25 2003/03/12 04:17:36 mohor
|
3654 |
|
|
-- 8051 interface added (besides WISHBONE interface). Selection is made in
|
3655 |
|
|
-- can_defines.v file.
|
3656 |
|
|
--
|
3657 |
|
|
-- Revision 1.24 2003/03/10 17:24:40 mohor
|
3658 |
|
|
-- wire declaration added.
|
3659 |
|
|
--
|
3660 |
|
|
-- Revision 1.23 2003/03/05 15:33:13 mohor
|
3661 |
|
|
-- tx_o is now tristated signal. tx_oen and tx_o combined together.
|
3662 |
|
|
--
|
3663 |
|
|
-- Revision 1.22 2003/03/05 15:01:56 mohor
|
3664 |
|
|
-- Top level signal names changed.
|
3665 |
|
|
--
|
3666 |
|
|
-- Revision 1.21 2003/03/01 22:53:33 mohor
|
3667 |
|
|
-- Actel APA ram supported.
|
3668 |
|
|
--
|
3669 |
|
|
-- Revision 1.20 2003/02/19 15:09:02 mohor
|
3670 |
|
|
-- Incomplete sensitivity list fixed.
|
3671 |
|
|
--
|
3672 |
|
|
-- Revision 1.19 2003/02/19 15:04:14 mohor
|
3673 |
|
|
-- Typo fixed.
|
3674 |
|
|
--
|
3675 |
|
|
-- Revision 1.18 2003/02/19 14:44:03 mohor
|
3676 |
|
|
-- CAN core finished. Host interface added. Registers finished.
|
3677 |
|
|
-- Synchronization to the wishbone finished.
|
3678 |
|
|
--
|
3679 |
|
|
-- Revision 1.17 2003/02/18 00:10:15 mohor
|
3680 |
|
|
-- Most of the registers added. Registers "arbitration lost capture", "error code
|
3681 |
|
|
-- capture" + few more still need to be added.
|
3682 |
|
|
--
|
3683 |
|
|
-- Revision 1.16 2003/02/14 20:17:01 mohor
|
3684 |
|
|
-- Several registers added. Not finished, yet.
|
3685 |
|
|
--
|
3686 |
|
|
-- Revision 1.15 2003/02/12 14:25:30 mohor
|
3687 |
|
|
-- abort_tx added.
|
3688 |
|
|
--
|
3689 |
|
|
-- Revision 1.14 2003/02/11 00:56:06 mohor
|
3690 |
|
|
-- Wishbone interface added.
|
3691 |
|
|
--
|
3692 |
|
|
-- Revision 1.13 2003/02/09 18:40:29 mohor
|
3693 |
|
|
-- Overload fixed. Hard synchronization also enabled at the last bit of
|
3694 |
|
|
-- interframe.
|
3695 |
|
|
--
|
3696 |
|
|
-- Revision 1.12 2003/02/09 02:24:33 mohor
|
3697 |
|
|
-- Bosch license warning added. Error counters finished. Overload frames
|
3698 |
|
|
-- still need to be fixed.
|
3699 |
|
|
--
|
3700 |
|
|
-- Revision 1.11 2003/02/04 14:34:52 mohor
|
3701 |
|
|
-- *** empty log message ***
|
3702 |
|
|
--
|
3703 |
|
|
-- Revision 1.10 2003/01/31 01:13:38 mohor
|
3704 |
|
|
-- backup.
|
3705 |
|
|
--
|
3706 |
|
|
-- Revision 1.9 2003/01/15 13:16:48 mohor
|
3707 |
|
|
-- When a frame with "remote request" is received, no data is stored to
|
3708 |
|
|
-- fifo, just the frame information (identifier, ...). Data length that
|
3709 |
|
|
-- is stored is the received data length and not the actual data length
|
3710 |
|
|
-- that is stored to fifo.
|
3711 |
|
|
--
|
3712 |
|
|
-- Revision 1.8 2003/01/14 17:25:09 mohor
|
3713 |
|
|
-- Addresses corrected to decimal values (previously hex).
|
3714 |
|
|
--
|
3715 |
|
|
-- Revision 1.7 2003/01/10 17:51:34 mohor
|
3716 |
|
|
-- Temporary version (backup).
|
3717 |
|
|
--
|
3718 |
|
|
-- Revision 1.6 2003/01/09 21:54:45 mohor
|
3719 |
|
|
-- rx fifo added. Not 100 % verified, yet.
|
3720 |
|
|
--
|
3721 |
|
|
-- Revision 1.5 2003/01/08 02:10:56 mohor
|
3722 |
|
|
-- Acceptance filter added.
|
3723 |
|
|
--
|
3724 |
|
|
-- Revision 1.4 2002/12/28 04:13:23 mohor
|
3725 |
|
|
-- Backup version.
|
3726 |
|
|
--
|
3727 |
|
|
-- Revision 1.3 2002/12/27 00:12:52 mohor
|
3728 |
|
|
-- Header changed, testbench improved to send a frame (crc still missing).
|
3729 |
|
|
--
|
3730 |
|
|
-- Revision 1.2 2002/12/26 16:00:34 mohor
|
3731 |
|
|
-- Testbench define file added. Clock divider register added.
|
3732 |
|
|
--
|
3733 |
|
|
-- Revision 1.1.1.1 2002/12/20 16:39:21 mohor
|
3734 |
|
|
-- Initial
|
3735 |
|
|
--
|
3736 |
|
|
--
|
3737 |
|
|
--
|
3738 |
|
|
-- synopsys translate_off
|
3739 |
|
|
--`include "can_defines.v"
|
3740 |
|
|
-- synopsys translate_on
|
3741 |
|
|
|
3742 |
|
|
LIBRARY ieee;
|
3743 |
|
|
USE ieee.std_logic_1164.all;
|
3744 |
|
|
use ieee.numeric_std.all;
|
3745 |
|
|
|
3746 |
|
|
library grlib;
|
3747 |
|
|
use grlib.stdlib.all;
|
3748 |
|
|
|
3749 |
|
|
ENTITY can_top_core_sync IS
|
3750 |
|
|
PORT (
|
3751 |
|
|
|
3752 |
|
|
clk : IN std_logic;
|
3753 |
|
|
reset_n : IN std_logic;
|
3754 |
|
|
|
3755 |
|
|
-- Config
|
3756 |
|
|
sjw : IN std_logic_vector(1 DOWNTO 0);
|
3757 |
|
|
bitrate : IN std_logic_vector(10 DOWNTO 0); --##
|
3758 |
|
|
tseg1 : IN std_logic_vector(3 DOWNTO 0);
|
3759 |
|
|
tseg2 : IN std_logic_vector(2 DOWNTO 0);
|
3760 |
|
|
auto_restart : IN std_logic;
|
3761 |
|
|
sampling : IN std_logic;
|
3762 |
|
|
edge_mode : IN std_logic;
|
3763 |
|
|
|
3764 |
|
|
-- Transmit buffer
|
3765 |
|
|
tx_data : IN std_logic_vector(63 DOWNTO 0);
|
3766 |
|
|
tx_id : IN std_logic_vector(28 DOWNTO 0);
|
3767 |
|
|
tx_dlc : IN std_logic_vector(3 DOWNTO 0);
|
3768 |
|
|
tx_rtr : IN std_logic;
|
3769 |
|
|
tx_ide : IN std_logic;
|
3770 |
|
|
tx_msg_rdy : OUT std_logic;
|
3771 |
|
|
tx_request : IN std_logic;
|
3772 |
|
|
|
3773 |
|
|
-- start-stop control
|
3774 |
|
|
clr_stop : IN std_logic;
|
3775 |
|
|
set_stop : IN std_logic;
|
3776 |
|
|
|
3777 |
|
|
-- start-stop status
|
3778 |
|
|
want_stop : OUT std_logic;
|
3779 |
|
|
grant_stop : OUT std_logic;
|
3780 |
|
|
|
3781 |
|
|
-- Receive buffer
|
3782 |
|
|
rx_data : OUT std_logic_vector(63 DOWNTO 0);
|
3783 |
|
|
rx_id : OUT std_logic_vector(28 DOWNTO 0);
|
3784 |
|
|
rx_dlc : OUT std_logic_vector(3 DOWNTO 0);
|
3785 |
|
|
rx_rtr : OUT std_logic;
|
3786 |
|
|
rx_ide : OUT std_logic;
|
3787 |
|
|
rx_msg_rdy : OUT std_logic;
|
3788 |
|
|
|
3789 |
|
|
-- Interrupt events
|
3790 |
|
|
crc_err : OUT std_logic;
|
3791 |
|
|
form_err : OUT std_logic;
|
3792 |
|
|
ack_err : OUT std_logic;
|
3793 |
|
|
stuff_err : OUT std_logic;
|
3794 |
|
|
bit_err : OUT std_logic;
|
3795 |
|
|
arb_loss : OUT std_logic;
|
3796 |
|
|
overload : OUT std_logic;
|
3797 |
|
|
|
3798 |
|
|
-- Status and error counters
|
3799 |
|
|
error_state : OUT std_logic_vector(1 DOWNTO 0);
|
3800 |
|
|
rx_err_gte96 : OUT std_logic;
|
3801 |
|
|
tx_err_gte96 : OUT std_logic;
|
3802 |
|
|
rx_err_cnt : OUT std_logic_vector(7 DOWNTO 0);
|
3803 |
|
|
tx_err_cnt : OUT std_logic_vector(8 DOWNTO 0);
|
3804 |
|
|
|
3805 |
|
|
-- CAN frame reference
|
3806 |
|
|
rx_mode : OUT std_logic;
|
3807 |
|
|
tx_mode : OUT std_logic;
|
3808 |
|
|
field : OUT std_logic_vector(4 DOWNTO 0);
|
3809 |
|
|
bit_nr : OUT std_logic_vector(5 DOWNTO 0);
|
3810 |
|
|
stuff_ind : OUT std_logic;
|
3811 |
|
|
remote_ind : OUT std_logic;
|
3812 |
|
|
extended_ind : OUT std_logic;
|
3813 |
|
|
|
3814 |
|
|
-- CAN physical layer interface
|
3815 |
|
|
can_rx_bus : IN std_logic;
|
3816 |
|
|
can_tx_bus : OUT std_logic;
|
3817 |
|
|
can_bus_ebl_n : OUT std_logic);
|
3818 |
|
|
|
3819 |
|
|
END ENTITY can_top_core_sync;
|
3820 |
|
|
|
3821 |
|
|
ARCHITECTURE RTL OF can_top_core_sync IS
|
3822 |
|
|
|
3823 |
|
|
COMPONENT can_bsp_core_sync
|
3824 |
|
|
PORT (
|
3825 |
|
|
clk : IN std_logic;
|
3826 |
|
|
rst : IN std_logic;
|
3827 |
|
|
restart : IN std_logic;
|
3828 |
|
|
sample_point : IN std_logic;
|
3829 |
|
|
sampled_bit : IN std_logic;
|
3830 |
|
|
sampled_bit_q : IN std_logic;
|
3831 |
|
|
tx_point : IN std_logic;
|
3832 |
|
|
hard_sync : IN std_logic;
|
3833 |
|
|
reset_mode : IN std_logic;
|
3834 |
|
|
listen_only_mode : IN std_logic;
|
3835 |
|
|
self_test_mode : IN std_logic;
|
3836 |
|
|
tx_request : IN std_logic;
|
3837 |
|
|
abort_tx : IN std_logic;
|
3838 |
|
|
self_rx_request : IN std_logic;
|
3839 |
|
|
single_shot_transmission: IN std_logic;
|
3840 |
|
|
tx_state : OUT std_logic;
|
3841 |
|
|
tx_state_q : OUT std_logic;
|
3842 |
|
|
overload_request : IN std_logic;
|
3843 |
|
|
overload_frame : OUT std_logic;
|
3844 |
|
|
read_arbitration_lost_capture_reg: IN std_logic;
|
3845 |
|
|
read_error_code_capture_reg: IN std_logic;
|
3846 |
|
|
error_capture_code : OUT std_logic_vector(7 DOWNTO 0);
|
3847 |
|
|
extended_mode : IN std_logic;
|
3848 |
|
|
rx_idle : OUT std_logic;
|
3849 |
|
|
transmitting : OUT std_logic;
|
3850 |
|
|
transmitter : OUT std_logic;
|
3851 |
|
|
go_rx_inter : OUT std_logic;
|
3852 |
|
|
not_first_bit_of_inter : OUT std_logic;
|
3853 |
|
|
rx_inter : OUT std_logic;
|
3854 |
|
|
node_bus_off : OUT std_logic;
|
3855 |
|
|
rx_err_cnt : OUT std_logic_vector(8 DOWNTO 0);
|
3856 |
|
|
tx_err_cnt : OUT std_logic_vector(8 DOWNTO 0);
|
3857 |
|
|
transmit_status : OUT std_logic;
|
3858 |
|
|
receive_status : OUT std_logic;
|
3859 |
|
|
tx_successful : OUT std_logic;
|
3860 |
|
|
need_to_tx : OUT std_logic;
|
3861 |
|
|
overrun : OUT std_logic;
|
3862 |
|
|
set_bus_error_irq : OUT std_logic;
|
3863 |
|
|
set_arbitration_lost_irq: OUT std_logic;
|
3864 |
|
|
arbitration_lost_capture: OUT std_logic_vector(4 DOWNTO 0);
|
3865 |
|
|
node_error_passive : OUT std_logic;
|
3866 |
|
|
node_error_active : OUT std_logic;
|
3867 |
|
|
tx_data_0 : IN std_logic_vector(7 DOWNTO 0);
|
3868 |
|
|
tx_data_1 : IN std_logic_vector(7 DOWNTO 0);
|
3869 |
|
|
tx_data_2 : IN std_logic_vector(7 DOWNTO 0);
|
3870 |
|
|
tx_data_3 : IN std_logic_vector(7 DOWNTO 0);
|
3871 |
|
|
tx_data_4 : IN std_logic_vector(7 DOWNTO 0);
|
3872 |
|
|
tx_data_5 : IN std_logic_vector(7 DOWNTO 0);
|
3873 |
|
|
tx_data_6 : IN std_logic_vector(7 DOWNTO 0);
|
3874 |
|
|
tx_data_7 : IN std_logic_vector(7 DOWNTO 0);
|
3875 |
|
|
tx_data_8 : IN std_logic_vector(7 DOWNTO 0);
|
3876 |
|
|
tx_data_9 : IN std_logic_vector(7 DOWNTO 0);
|
3877 |
|
|
tx_data_10 : IN std_logic_vector(7 DOWNTO 0);
|
3878 |
|
|
tx_data_11 : IN std_logic_vector(7 DOWNTO 0);
|
3879 |
|
|
tx_data_12 : IN std_logic_vector(7 DOWNTO 0);
|
3880 |
|
|
|
3881 |
|
|
rcv_msg_data : out std_logic_vector(63 downto 0);
|
3882 |
|
|
rcv_id : out std_logic_vector(28 downto 0);
|
3883 |
|
|
rcv_dlc : out std_logic_vector(3 downto 0);
|
3884 |
|
|
rcv_rtr : out std_logic;
|
3885 |
|
|
rcv_ide : out std_logic;
|
3886 |
|
|
rcv_msg_valid : out std_logic;
|
3887 |
|
|
|
3888 |
|
|
form_error : out std_logic;
|
3889 |
|
|
crc_error : out std_logic;
|
3890 |
|
|
ack_error : out std_logic;
|
3891 |
|
|
stuff_error : out std_logic;
|
3892 |
|
|
bit_error : out std_logic;
|
3893 |
|
|
arb_loss : out std_logic;
|
3894 |
|
|
|
3895 |
|
|
tx : OUT std_logic;
|
3896 |
|
|
tx_next : OUT std_logic;
|
3897 |
|
|
go_overload_frame : OUT std_logic;
|
3898 |
|
|
go_error_frame : OUT std_logic;
|
3899 |
|
|
go_tx : OUT std_logic;
|
3900 |
|
|
send_ack : OUT std_logic);
|
3901 |
|
|
END COMPONENT;
|
3902 |
|
|
|
3903 |
|
|
COMPONENT can_btl_core_sync
|
3904 |
|
|
PORT (
|
3905 |
|
|
clk : IN std_logic;
|
3906 |
|
|
rst : IN std_logic;
|
3907 |
|
|
rx : IN std_logic;
|
3908 |
|
|
tx : IN std_logic;
|
3909 |
|
|
baud_r_presc : IN std_logic_vector(10 DOWNTO 0); --##
|
3910 |
|
|
sync_jump_width : IN std_logic_vector(1 DOWNTO 0);
|
3911 |
|
|
time_segment1 : IN std_logic_vector(3 DOWNTO 0);
|
3912 |
|
|
time_segment2 : IN std_logic_vector(2 DOWNTO 0);
|
3913 |
|
|
triple_sampling : IN std_logic;
|
3914 |
|
|
sample_point : OUT std_logic;
|
3915 |
|
|
sampled_bit : OUT std_logic;
|
3916 |
|
|
sampled_bit_q : OUT std_logic;
|
3917 |
|
|
tx_point : OUT std_logic;
|
3918 |
|
|
hard_sync : OUT std_logic;
|
3919 |
|
|
rx_idle : IN std_logic;
|
3920 |
|
|
rx_inter : IN std_logic;
|
3921 |
|
|
transmitting : IN std_logic;
|
3922 |
|
|
transmitter : IN std_logic;
|
3923 |
|
|
go_rx_inter : IN std_logic;
|
3924 |
|
|
tx_next : IN std_logic;
|
3925 |
|
|
go_overload_frame : IN std_logic;
|
3926 |
|
|
go_error_frame : IN std_logic;
|
3927 |
|
|
go_tx : IN std_logic;
|
3928 |
|
|
send_ack : IN std_logic;
|
3929 |
|
|
node_error_passive : IN std_logic);
|
3930 |
|
|
END COMPONENT;
|
3931 |
|
|
|
3932 |
|
|
|
3933 |
|
|
|
3934 |
|
|
SIGNAL reset_mode : std_logic;
|
3935 |
|
|
SIGNAL listen_only_mode : std_logic;
|
3936 |
|
|
SIGNAL self_test_mode : std_logic;
|
3937 |
|
|
SIGNAL abort_tx : std_logic;
|
3938 |
|
|
SIGNAL self_rx_request : std_logic;
|
3939 |
|
|
SIGNAL single_shot_transmission : std_logic;
|
3940 |
|
|
|
3941 |
|
|
SIGNAL tx_state : std_logic;
|
3942 |
|
|
SIGNAL tx_state_q : std_logic;
|
3943 |
|
|
SIGNAL overload_request : std_logic;
|
3944 |
|
|
SIGNAL overload_frame : std_logic;
|
3945 |
|
|
|
3946 |
|
|
SIGNAL error_capture_code : std_logic_vector(7 DOWNTO 0);
|
3947 |
|
|
|
3948 |
|
|
-- Clock Divider register
|
3949 |
|
|
SIGNAL extended_mode : std_logic;
|
3950 |
|
|
|
3951 |
|
|
-- Tx data registers. Holding identifier (basic mode), tx frame information (extended mode) and data
|
3952 |
|
|
SIGNAL tx_data_0 : std_logic_vector(7 DOWNTO 0);
|
3953 |
|
|
SIGNAL tx_data_1 : std_logic_vector(7 DOWNTO 0);
|
3954 |
|
|
SIGNAL tx_data_2 : std_logic_vector(7 DOWNTO 0);
|
3955 |
|
|
SIGNAL tx_data_3 : std_logic_vector(7 DOWNTO 0);
|
3956 |
|
|
SIGNAL tx_data_4 : std_logic_vector(7 DOWNTO 0);
|
3957 |
|
|
SIGNAL tx_data_5 : std_logic_vector(7 DOWNTO 0);
|
3958 |
|
|
SIGNAL tx_data_6 : std_logic_vector(7 DOWNTO 0);
|
3959 |
|
|
SIGNAL tx_data_7 : std_logic_vector(7 DOWNTO 0);
|
3960 |
|
|
SIGNAL tx_data_8 : std_logic_vector(7 DOWNTO 0);
|
3961 |
|
|
SIGNAL tx_data_9 : std_logic_vector(7 DOWNTO 0);
|
3962 |
|
|
SIGNAL tx_data_10 : std_logic_vector(7 DOWNTO 0);
|
3963 |
|
|
SIGNAL tx_data_11 : std_logic_vector(7 DOWNTO 0);
|
3964 |
|
|
SIGNAL tx_data_12 : std_logic_vector(7 DOWNTO 0);
|
3965 |
|
|
|
3966 |
|
|
-- Output signals from can_btl_core_sync module
|
3967 |
|
|
SIGNAL sample_point : std_logic;
|
3968 |
|
|
SIGNAL sampled_bit : std_logic;
|
3969 |
|
|
SIGNAL sampled_bit_q : std_logic;
|
3970 |
|
|
SIGNAL tx_point : std_logic;
|
3971 |
|
|
SIGNAL hard_sync : std_logic;
|
3972 |
|
|
-- output from can_bsp_core_sync module
|
3973 |
|
|
SIGNAL rx_idle : std_logic;
|
3974 |
|
|
SIGNAL transmitting : std_logic;
|
3975 |
|
|
SIGNAL transmitter : std_logic;
|
3976 |
|
|
SIGNAL go_rx_inter : std_logic;
|
3977 |
|
|
SIGNAL not_first_bit_of_inter : std_logic;
|
3978 |
|
|
SIGNAL node_bus_off : std_logic;
|
3979 |
|
|
SIGNAL transmit_status : std_logic;
|
3980 |
|
|
SIGNAL receive_status : std_logic;
|
3981 |
|
|
SIGNAL tx_successful : std_logic;
|
3982 |
|
|
SIGNAL need_to_tx : std_logic;
|
3983 |
|
|
SIGNAL overrun : std_logic;
|
3984 |
|
|
SIGNAL node_error_passive : std_logic;
|
3985 |
|
|
SIGNAL node_error_active : std_logic;
|
3986 |
|
|
SIGNAL tx_next : std_logic;
|
3987 |
|
|
SIGNAL go_overload_frame : std_logic;
|
3988 |
|
|
SIGNAL go_error_frame : std_logic;
|
3989 |
|
|
SIGNAL go_tx : std_logic;
|
3990 |
|
|
SIGNAL send_ack : std_logic;
|
3991 |
|
|
-- SIGNAL rst : std_logic;
|
3992 |
|
|
|
3993 |
|
|
|
3994 |
|
|
SIGNAL rx_sync_tmp : std_logic;
|
3995 |
|
|
SIGNAL rx_sync : std_logic;
|
3996 |
|
|
|
3997 |
|
|
|
3998 |
|
|
SIGNAL xhdl_148 : std_logic_vector(8 DOWNTO 0);
|
3999 |
|
|
SIGNAL xhdl_150 : std_logic_vector(8 DOWNTO 0);
|
4000 |
|
|
|
4001 |
|
|
SIGNAL tx_o_xhdl3 : std_logic;
|
4002 |
|
|
|
4003 |
|
|
SIGNAL rx_inter : std_logic;
|
4004 |
|
|
|
4005 |
|
|
signal rst, restart : std_logic;
|
4006 |
|
|
signal ide, rtr : std_logic;
|
4007 |
|
|
signal tx_req, tx_request_q, tx_success : std_logic;
|
4008 |
|
|
|
4009 |
|
|
BEGIN
|
4010 |
|
|
|
4011 |
|
|
rst <= not reset_n;
|
4012 |
|
|
|
4013 |
|
|
-- outputs
|
4014 |
|
|
can_tx_bus <= tx_o_xhdl3;
|
4015 |
|
|
can_bus_ebl_n <= '1' when reset_n = '0' else '1';
|
4016 |
|
|
|
4017 |
|
|
rx_err_cnt <= xhdl_148(7 DOWNTO 0);
|
4018 |
|
|
tx_err_cnt <= xhdl_150(8 DOWNTO 0);
|
4019 |
|
|
rx_err_gte96 <= '1' when unsigned(xhdl_148) >= 96 else '0';
|
4020 |
|
|
tx_err_gte96 <= '1' when unsigned(xhdl_150) >= 96 else '0';
|
4021 |
|
|
error_state(0) <= '0' when (node_error_active = '1') else '1';
|
4022 |
|
|
error_state(1) <= '0' when (node_bus_off = '0') else '1';
|
4023 |
|
|
|
4024 |
|
|
tx_msg_rdy <= tx_success;
|
4025 |
|
|
|
4026 |
|
|
rx_rtr <= rtr;
|
4027 |
|
|
rx_ide <= ide;
|
4028 |
|
|
|
4029 |
|
|
rx_mode <= receive_status;
|
4030 |
|
|
tx_mode <= tx_state or tx_success; --## transmit_status;
|
4031 |
|
|
|
4032 |
|
|
remote_ind <= rtr;
|
4033 |
|
|
extended_ind <= ide;
|
4034 |
|
|
stuff_ind <= '0';
|
4035 |
|
|
bit_nr <= (others => '0');
|
4036 |
|
|
field <= (others => '0');
|
4037 |
|
|
overload <= overload_frame;
|
4038 |
|
|
|
4039 |
|
|
want_stop <= '0';
|
4040 |
|
|
grant_stop <= '0';
|
4041 |
|
|
|
4042 |
|
|
i_can_btl_core_sync : can_btl_core_sync
|
4043 |
|
|
PORT MAP (
|
4044 |
|
|
clk => clk,
|
4045 |
|
|
rst => rst,
|
4046 |
|
|
rx => rx_sync,
|
4047 |
|
|
tx => tx_o_xhdl3,
|
4048 |
|
|
baud_r_presc => bitrate, --##
|
4049 |
|
|
sync_jump_width => sjw,
|
4050 |
|
|
time_segment1 => tseg1,
|
4051 |
|
|
time_segment2 => tseg2,
|
4052 |
|
|
triple_sampling => sampling,
|
4053 |
|
|
sample_point => sample_point,
|
4054 |
|
|
sampled_bit => sampled_bit,
|
4055 |
|
|
sampled_bit_q => sampled_bit_q,
|
4056 |
|
|
tx_point => tx_point,
|
4057 |
|
|
hard_sync => hard_sync,
|
4058 |
|
|
rx_idle => rx_idle,
|
4059 |
|
|
rx_inter => rx_inter,
|
4060 |
|
|
transmitting => transmitting,
|
4061 |
|
|
transmitter => transmitter,
|
4062 |
|
|
go_rx_inter => go_rx_inter,
|
4063 |
|
|
tx_next => tx_next,
|
4064 |
|
|
go_overload_frame => go_overload_frame,
|
4065 |
|
|
go_error_frame => go_error_frame,
|
4066 |
|
|
go_tx => go_tx,
|
4067 |
|
|
send_ack => send_ack,
|
4068 |
|
|
node_error_passive => node_error_passive);
|
4069 |
|
|
|
4070 |
|
|
|
4071 |
|
|
-- TX format conversion
|
4072 |
|
|
tx_data_0 <= tx_ide & tx_rtr & "00" & tx_dlc;
|
4073 |
|
|
tx_data_1 <= tx_id(28 downto 21);
|
4074 |
|
|
tx_data_2 <= tx_id(20 downto 18) & "00000" when tx_ide = '0' else tx_id(20 downto 13);
|
4075 |
|
|
tx_data_3 <= tx_data(63 downto 56) when tx_ide = '0' else tx_id(12 downto 5);
|
4076 |
|
|
tx_data_4 <= tx_data(55 downto 48) when tx_ide = '0' else tx_id(4 downto 0) & "000";
|
4077 |
|
|
tx_data_5 <= tx_data(47 downto 40) when tx_ide = '0' else tx_data(63 downto 56);
|
4078 |
|
|
tx_data_6 <= tx_data(39 downto 32) when tx_ide = '0' else tx_data(55 downto 48);
|
4079 |
|
|
tx_data_7 <= tx_data(31 downto 24) when tx_ide = '0' else tx_data(47 downto 40);
|
4080 |
|
|
tx_data_8 <= tx_data(23 downto 16) when tx_ide = '0' else tx_data(39 downto 32);
|
4081 |
|
|
tx_data_9 <= tx_data(15 downto 8) when tx_ide = '0' else tx_data(31 downto 24);
|
4082 |
|
|
tx_data_10 <= tx_data(7 downto 0) when tx_ide = '0' else tx_data(23 downto 16);
|
4083 |
|
|
tx_data_11 <= tx_data(15 downto 8);
|
4084 |
|
|
tx_data_12 <= tx_data(7 downto 0);
|
4085 |
|
|
|
4086 |
|
|
|
4087 |
|
|
reset_mode <= '1' when rst = '1' else '0';
|
4088 |
|
|
listen_only_mode <= '0';
|
4089 |
|
|
self_test_mode <= '0';
|
4090 |
|
|
extended_mode <= '1';
|
4091 |
|
|
overload_request <= '0';
|
4092 |
|
|
abort_tx <= '0';
|
4093 |
|
|
self_rx_request <= '0';
|
4094 |
|
|
single_shot_transmission <= '1'; --##
|
4095 |
|
|
|
4096 |
|
|
restart <= '1' when (auto_restart = '0' and clr_stop = '1') else '0';
|
4097 |
|
|
|
4098 |
|
|
-- generate pulse
|
4099 |
|
|
process(clk,rst)
|
4100 |
|
|
begin
|
4101 |
|
|
if rst='1' then
|
4102 |
|
|
tx_req <= '0';
|
4103 |
|
|
elsif Rising_Edge(clk) then
|
4104 |
|
|
if tx_request='1' and transmit_status='0' then
|
4105 |
|
|
tx_req <= '1';
|
4106 |
|
|
elsif transmit_status='1' then
|
4107 |
|
|
tx_req <= '0';
|
4108 |
|
|
end if;
|
4109 |
|
|
end if;
|
4110 |
|
|
end process;
|
4111 |
|
|
|
4112 |
|
|
|
4113 |
|
|
i_can_bsp_core_sync : can_bsp_core_sync
|
4114 |
|
|
PORT MAP (
|
4115 |
|
|
clk => clk,
|
4116 |
|
|
rst => rst,
|
4117 |
|
|
restart => restart,
|
4118 |
|
|
sample_point => sample_point,
|
4119 |
|
|
sampled_bit => sampled_bit,
|
4120 |
|
|
sampled_bit_q => sampled_bit_q,
|
4121 |
|
|
tx_point => tx_point,
|
4122 |
|
|
hard_sync => hard_sync,
|
4123 |
|
|
reset_mode => reset_mode,
|
4124 |
|
|
listen_only_mode => listen_only_mode,
|
4125 |
|
|
self_test_mode => self_test_mode,
|
4126 |
|
|
tx_request => tx_req, --## tx_request, --##
|
4127 |
|
|
abort_tx => abort_tx,
|
4128 |
|
|
self_rx_request => self_rx_request,
|
4129 |
|
|
single_shot_transmission => single_shot_transmission,
|
4130 |
|
|
tx_state => tx_state,
|
4131 |
|
|
tx_state_q => tx_state_q,
|
4132 |
|
|
overload_request => overload_request,
|
4133 |
|
|
overload_frame => overload_frame,
|
4134 |
|
|
read_arbitration_lost_capture_reg => '0',
|
4135 |
|
|
read_error_code_capture_reg => '0',
|
4136 |
|
|
error_capture_code => open,
|
4137 |
|
|
extended_mode => extended_mode,
|
4138 |
|
|
rx_idle => rx_idle,
|
4139 |
|
|
transmitting => transmitting,
|
4140 |
|
|
transmitter => transmitter,
|
4141 |
|
|
go_rx_inter => go_rx_inter,
|
4142 |
|
|
not_first_bit_of_inter => not_first_bit_of_inter,
|
4143 |
|
|
rx_inter => rx_inter,
|
4144 |
|
|
node_bus_off => node_bus_off,
|
4145 |
|
|
rx_err_cnt => xhdl_148,
|
4146 |
|
|
tx_err_cnt => xhdl_150,
|
4147 |
|
|
transmit_status => transmit_status,
|
4148 |
|
|
receive_status => receive_status,
|
4149 |
|
|
tx_successful => tx_successful,
|
4150 |
|
|
need_to_tx => need_to_tx,
|
4151 |
|
|
overrun => overrun,
|
4152 |
|
|
|
4153 |
|
|
set_bus_error_irq => open,
|
4154 |
|
|
set_arbitration_lost_irq => open,
|
4155 |
|
|
arbitration_lost_capture => open,
|
4156 |
|
|
node_error_passive => node_error_passive,
|
4157 |
|
|
node_error_active => node_error_active,
|
4158 |
|
|
|
4159 |
|
|
tx_data_0 => tx_data_0,
|
4160 |
|
|
tx_data_1 => tx_data_1,
|
4161 |
|
|
tx_data_2 => tx_data_2,
|
4162 |
|
|
tx_data_3 => tx_data_3,
|
4163 |
|
|
tx_data_4 => tx_data_4,
|
4164 |
|
|
tx_data_5 => tx_data_5,
|
4165 |
|
|
tx_data_6 => tx_data_6,
|
4166 |
|
|
tx_data_7 => tx_data_7,
|
4167 |
|
|
tx_data_8 => tx_data_8,
|
4168 |
|
|
tx_data_9 => tx_data_9,
|
4169 |
|
|
tx_data_10 => tx_data_10,
|
4170 |
|
|
tx_data_11 => tx_data_11,
|
4171 |
|
|
tx_data_12 => tx_data_12,
|
4172 |
|
|
|
4173 |
|
|
rcv_msg_data => rx_data,
|
4174 |
|
|
rcv_id => rx_id,
|
4175 |
|
|
rcv_dlc => rx_dlc,
|
4176 |
|
|
rcv_rtr => rtr,
|
4177 |
|
|
rcv_ide => ide,
|
4178 |
|
|
rcv_msg_valid => rx_msg_rdy,
|
4179 |
|
|
|
4180 |
|
|
form_error => form_err,
|
4181 |
|
|
crc_error => crc_err,
|
4182 |
|
|
ack_error => ack_err,
|
4183 |
|
|
stuff_error => stuff_err,
|
4184 |
|
|
bit_error => bit_err,
|
4185 |
|
|
arb_loss => arb_loss,
|
4186 |
|
|
|
4187 |
|
|
tx => tx_o_xhdl3,
|
4188 |
|
|
tx_next => tx_next,
|
4189 |
|
|
go_overload_frame => go_overload_frame,
|
4190 |
|
|
go_error_frame => go_error_frame,
|
4191 |
|
|
go_tx => go_tx,
|
4192 |
|
|
send_ack => send_ack);
|
4193 |
|
|
|
4194 |
|
|
PROCESS (clk, rst)
|
4195 |
|
|
BEGIN
|
4196 |
|
|
IF (clk'EVENT AND clk = '1') THEN
|
4197 |
|
|
IF (rst = '1') THEN
|
4198 |
|
|
-- rx_sync_tmp <= '1';
|
4199 |
|
|
rx_sync <= '1';
|
4200 |
|
|
tx_request_q <= '0';
|
4201 |
|
|
tx_success <= '0';
|
4202 |
|
|
ELSE
|
4203 |
|
|
-- rx_sync_tmp <= can_rx_bus;
|
4204 |
|
|
-- rx_sync <= rx_sync_tmp ;
|
4205 |
|
|
rx_sync <= can_rx_bus;
|
4206 |
|
|
tx_request_q <= tx_request;
|
4207 |
|
|
tx_success <= tx_successful;
|
4208 |
|
|
END IF;
|
4209 |
|
|
END IF;
|
4210 |
|
|
END PROCESS;
|
4211 |
|
|
|
4212 |
|
|
END ARCHITECTURE RTL;
|