]> rtime.felk.cvut.cz Git - fpga/zynq/canbench-sw.git/blob - system/ip/sja1000_1.0/hdl/can_register_asyn_syn.v
added sja1000 IP
[fpga/zynq/canbench-sw.git] / system / ip / sja1000_1.0 / hdl / can_register_asyn_syn.v
1 //////////////////////////////////////////////////////////////////////
2 ////                                                              ////
3 ////  can_register_asyn_syn.v                                     ////
4 ////                                                              ////
5 ////                                                              ////
6 ////  This file is part of the CAN Protocol Controller            ////
7 ////  http://www.opencores.org/projects/can/                      ////
8 ////                                                              ////
9 ////                                                              ////
10 ////  Author(s):                                                  ////
11 ////       Igor Mohor                                             ////
12 ////       igorm@opencores.org                                    ////
13 ////                                                              ////
14 ////                                                              ////
15 ////  All additional information is available in the README.txt   ////
16 ////  file.                                                       ////
17 ////                                                              ////
18 //////////////////////////////////////////////////////////////////////
19 ////                                                              ////
20 //// Copyright (C) 2002, 2003, 2004 Authors                       ////
21 ////                                                              ////
22 //// This source file may be used and distributed without         ////
23 //// restriction provided that this copyright statement is not    ////
24 //// removed from the file and that any derivative work contains  ////
25 //// the original copyright notice and the associated disclaimer. ////
26 ////                                                              ////
27 //// This source file is free software; you can redistribute it   ////
28 //// and/or modify it under the terms of the GNU Lesser General   ////
29 //// Public License as published by the Free Software Foundation; ////
30 //// either version 2.1 of the License, or (at your option) any   ////
31 //// later version.                                               ////
32 ////                                                              ////
33 //// This source is distributed in the hope that it will be       ////
34 //// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35 //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36 //// PURPOSE.  See the GNU Lesser General Public License for more ////
37 //// details.                                                     ////
38 ////                                                              ////
39 //// You should have received a copy of the GNU Lesser General    ////
40 //// Public License along with this source; if not, download it   ////
41 //// from http://www.opencores.org/lgpl.shtml                     ////
42 ////                                                              ////
43 //// The CAN protocol is developed by Robert Bosch GmbH and       ////
44 //// protected by patents. Anybody who wants to implement this    ////
45 //// CAN IP core on silicon has to obtain a CAN protocol license  ////
46 //// from Bosch.                                                  ////
47 ////                                                              ////
48 //////////////////////////////////////////////////////////////////////
49 //
50 // CVS Revision History
51 //
52 // $Log: not supported by cvs2svn $
53 // Revision 1.6  2003/03/20 16:52:43  mohor
54 // unix.
55 //
56 // Revision 1.4  2003/03/11 16:32:34  mohor
57 // timescale.v is used for simulation only.
58 //
59 // Revision 1.3  2003/02/09 02:24:33  mohor
60 // Bosch license warning added. Error counters finished. Overload frames
61 // still need to be fixed.
62 //
63 // Revision 1.2  2002/12/27 00:12:52  mohor
64 // Header changed, testbench improved to send a frame (crc still missing).
65 //
66 // Revision 1.1.1.1  2002/12/20 16:39:21  mohor
67 // Initial
68 //
69 //
70 //
71
72 // synopsys translate_off
73 `include "timescale.v"
74 // synopsys translate_on
75
76
77 module can_register_asyn_syn
78 ( data_in,
79   data_out,
80   we,
81   clk,
82   rst,
83   rst_sync
84 );
85
86 parameter WIDTH = 8; // default parameter of the register width
87 parameter RESET_VALUE = 0;
88
89 input [WIDTH-1:0] data_in;
90 input             we;
91 input             clk;
92 input             rst;
93 input             rst_sync;
94
95 output [WIDTH-1:0] data_out;
96 reg    [WIDTH-1:0] data_out;
97
98
99
100 always @ (posedge clk or posedge rst)
101 begin
102   if(rst)
103     data_out<=#1 RESET_VALUE;
104   else if (rst_sync)                  // synchronous reset
105     data_out<=#1 RESET_VALUE;
106   else if (we)                        // write
107     data_out<=#1 data_in;
108 end
109
110
111
112 endmodule