OpenCores
URL https://opencores.org/ocsvn/k68/k68/trunk

Subversion Repositories k68

[/] [k68/] [trunk/] [rtl/] [verilog/] [k68_appl.v] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sybreon
//                              -*- Mode: Verilog -*-
2
// Filename        : k68_appl.v
3
// Description     : K68 uController RISC Application
4
// Author          : Shawn Tan
5
// Created On      : Tue Mar 25 16:19:58 2003
6
// Last Modified By: .
7
// Last Modified On: .
8
// Update Count    : 0
9
// Status          : Unknown, Use with caution!
10
/////////////////////////////////////////////////////////////////////
11
////                                                             ////
12
//// Copyright (C) 2002 to Shawn Tan Ser Ngiap.                  ////
13
////                       shawn.tan@aeste.net                   ////
14
////                                                             ////
15
//// This source file may be used and distributed without        ////
16
//// restriction provided that this copyright statement is not   ////
17
//// removed from the file and that any derivative work contains ////
18
//// the original copyright notice and the associated disclaimer.////
19
////                                                             ////
20
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
21
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
22
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
23
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
24
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
25
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
26
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
27
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
28
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
29
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
30
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
31
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
32
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
33
////                                                             ////
34
/////////////////////////////////////////////////////////////////////
35
//
36
// Xilinx specific implementation successful on a Spartan2-200
37
//
38
// You should write your own k68_appl layer depending on application.
39
// For the example application, it instantiates internal XILINX ram
40
// for both ROM and RAM. We use the INIT_XX specification in the UCF
41
// file to define the contents of the ROM with our software.
42
//
43
// To do this, you'll need to use the software splitrom to get the
44
// values to put into the UCF file. Refer to the documentation for
45
// more information.
46
//
47
// You can also include any other peripherals here that are not in
48
// the main core. Any modifications to the core, should be made at
49
// k68_cpu and below. Any additional internal components should be
50
// added to the k68_soc. Any extra peripherals should be added to
51
// k68_appl.
52
//
53
////////////////////////////////////////////////////////////////////
54
 
55
`include "k68_defines.v"
56
 
57
module k68_appl (/*AUTOARG*/
58
   // Outputs
59
   tx_o, rts_o, clk_o, dbg_o,
60
   // Inputs
61
   clk_i, rst_i, int_i, rx_i, cts_i
62
   ) ;
63
 
64
   parameter aw = `k68_ADDR_W;
65
   parameter dw = `k68_DATA_W;
66
 
67
   input clk_i,rst_i;
68
   input [2:0]      int_i;
69
 
70
   wire [aw-1:0] add_o;
71
   wire [dw-1:0] m_dat_i;
72
   wire [dw-1:0] dat_o;
73
   wire [dw-1:0] p_dat_i;
74
   wire [dw-1:0] dat_i;
75
   wire          we_o;
76
 
77
   input [1:0]    rx_i,cts_i;
78
   output [1:0]  tx_o,rts_o;
79
   output        clk_o;
80
   wire          rst_o;
81
 
82
   output [7:0] dbg_o;
83
 
84
   reg [22:0]    cnt;
85
   wire         clk;
86
   assign       clk = cnt[22];
87
   always @(posedge clk_i) cnt <= cnt + 1'b1;
88
 
89
   assign       dbg_o = {add_o[9:2]};
90
 
91
   // 
92
   // SPROM uses Xilinx internal RAM as ROM
93
   // 2kB of ROM.
94
   // 
95
   RAMB4_S8 rom0(
96
                 .WE(1'b0),
97
                 .EN(1'b1),
98
                 .RST(1'b0),
99
                 .CLK(clk_o),
100
                 .ADDR(add_o[10:2]),
101
                 .DO(p_dat_i[7:0])
102
                 );
103
 
104
   RAMB4_S8 rom1(
105
                 .WE(1'b0),
106
                 .EN(1'b1),
107
                 .RST(1'b0),
108
                 .CLK(clk_o),
109
                 .ADDR(add_o[10:2]),
110
                 .DO(p_dat_i[15:8])
111
                 );
112
 
113
   RAMB4_S8 rom2(
114
                 .WE(1'b0),
115
                 .EN(1'b1),
116
                 .RST(1'b0),
117
                 .CLK(clk_o),
118
                 .ADDR(add_o[10:2]),
119
                 .DO(p_dat_i[23:16])
120
                 );
121
 
122
   RAMB4_S8 rom3(
123
                 .WE(1'b0),
124
                 .EN(1'b1),
125
                 .RST(1'b0),
126
                 .CLK(clk_o),
127
                 .ADDR(add_o[10:2]),
128
                 .DO(p_dat_i[31:24])
129
                 );
130
 
131
   //
132
   // SPRAM uses Xilinx Internal RAM
133
   // 2kB of RAM
134
   // To have more RAM, instantiate several units of RAM and map
135
   // the addresses.
136
   //
137
   RAMB4_S8 ram0(
138
                 .WE(we_o),
139
                 .EN(1'b1),
140
                 .RST(rst_o),
141
                 .CLK(clk_o),
142
                 .ADDR(add_o[10:2]),
143
                 .DO(m_dat_i[7:0]),
144
                 .DI(dat_o[7:0])
145
                 );
146
 
147
   RAMB4_S8 ram1(
148
                 .WE(we_o),
149
                 .EN(1'b1),
150
                 .RST(rst_o),
151
                 .CLK(clk_o),
152
                 .ADDR(add_o[10:2]),
153
                 .DO(m_dat_i[15:8]),
154
                 .DI(dat_o[15:8])
155
                 );
156
 
157
   RAMB4_S8 ram2(
158
                 .WE(we_o),
159
                 .EN(1'b1),
160
                 .RST(rst_o),
161
                 .CLK(clk_o),
162
                 .ADDR(add_o[10:2]),
163
                 .DO(m_dat_i[23:16]),
164
                 .DI(dat_o[23:16])
165
                 );
166
 
167
   RAMB4_S8 ram3(
168
                 .WE(we_o),
169
                 .EN(1'b1),
170
                 .RST(rst_o),
171
                 .CLK(clk_o),
172
                 .ADDR(add_o[10:2]),
173
                 .DO(m_dat_i[31:24]),
174
                 .DI(dat_o[31:24])
175
                 );
176
 
177
 
178
   assign dat_i = (add_o[aw-1] == 1'b1) ? m_dat_i : p_dat_i;
179
 
180
   k68_soc soc0 (
181
                 .add_o(add_o),
182
                 .dat_o(dat_o),
183
                 .dat_i(dat_i),
184
                 .we_o(we_o),
185
                 .tx_o(tx_o),.rts_o(rts_o),
186
                 .rx_i(rx_i),.cts_i(cts_i),
187
                 .int_i(int_i),
188
                 .clk_o(clk_o), .rst_o(rst_o),
189
                 .clk_i(clk_i), .rst_i(rst_i)
190
                 );
191
 
192
endmodule // k68_appl

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.