1 //////////////////////////////////////////////////////////////////////
6 //// This file is part of the CAN Protocol Controller ////
7 //// http://www.opencores.org/projects/can/ ////
12 //// igorm@opencores.org ////
13 //// Martin Jerabek ////
14 //// jerabma7@fel.cvut.cz ////
17 //// All additional information is available in the README.txt ////
20 //////////////////////////////////////////////////////////////////////
22 //// Copyright (C) 2002, 2003, 2004 Authors ////
24 //// This source file may be used and distributed without ////
25 //// restriction provided that this copyright statement is not ////
26 //// removed from the file and that any derivative work contains ////
27 //// the original copyright notice and the associated disclaimer. ////
29 //// This source file is free software; you can redistribute it ////
30 //// and/or modify it under the terms of the GNU Lesser General ////
31 //// Public License as published by the Free Software Foundation; ////
32 //// either version 2.1 of the License, or (at your option) any ////
33 //// later version. ////
35 //// This source is distributed in the hope that it will be ////
36 //// useful, but WITHOUT ANY WARRANTY; without even the implied ////
37 //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
38 //// PURPOSE. See the GNU Lesser General Public License for more ////
41 //// You should have received a copy of the GNU Lesser General ////
42 //// Public License along with this source; if not, download it ////
43 //// from http://www.opencores.org/lgpl.shtml ////
45 //// The CAN protocol is developed by Robert Bosch GmbH and ////
46 //// protected by patents. Anybody who wants to implement this ////
47 //// CAN IP core on silicon has to obtain a CAN protocol license ////
50 //////////////////////////////////////////////////////////////////////
52 // synopsys translate_off
53 `include "timescale.v"
54 // synopsys translate_on
55 `include "can_defines.v"
84 output [7:0] wb_dat_o;
95 output [7:0] reg_data_in_o;
96 input [7:0] reg_data_out_i;
110 assign cs_can_i = 1'b1;
112 // Combining wb_cyc_i and wb_stb_i signals to cs signal. Than synchronizing to clk_i clock domain.
113 always @ (posedge clk_i or posedge rst)
120 cs_sync_rst1 <= 1'b0;
121 cs_sync_rst2 <= 1'b0;
125 cs_sync1 <=#Tp wb_cyc_i & wb_stb_i & (~cs_sync_rst2) & cs_can_i;
126 cs_sync2 <=#Tp cs_sync1 & (~cs_sync_rst2);
127 cs_sync3 <=#Tp cs_sync2 & (~cs_sync_rst2);
128 cs_sync_rst1 <=#Tp cs_ack3;
129 cs_sync_rst2 <=#Tp cs_sync_rst1;
134 assign reg_cs_o = cs_sync2 & (~cs_sync3);
137 always @ (posedge wb_clk_i)
139 cs_ack1 <=#Tp cs_sync3;
140 cs_ack2 <=#Tp cs_ack1;
141 cs_ack3 <=#Tp cs_ack2;
146 // Generating acknowledge signal
147 always @ (posedge wb_clk_i)
149 wb_ack_o <=#Tp (cs_ack2 & (~cs_ack3));
153 assign reg_rst_o = wb_rst_i;
154 assign reg_we_o = wb_we_i;
155 assign reg_addr_o = wb_adr_i;
156 assign reg_data_in_o = wb_dat_i;
157 assign wb_dat_o = reg_data_out_i;