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

Subversion Repositories next186

[/] [next186/] [trunk/] [sample/] [system.v] - Blame information for rev 9

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

Line No. Rev Author Line
1 2 ndumitrach
//////////////////////////////////////////////////////////////////////////////////
2
//
3
// This file is part of the Next186 project
4
// http://opencores.org/project,next186
5
//
6
// Filename: system.v
7 3 ndumitrach
// Description: Next80186 evaluation system with 4K SRAM, working at 80MHZ
8 2 ndumitrach
// Version 1.0
9
// Creation date: 20Jan2012 - 10Mar2012
10
//
11
// Author: Nicolae Dumitrache 
12
// e-mail: ndumitrache@opencores.org
13
//
14
/////////////////////////////////////////////////////////////////////////////////
15
// 
16 3 ndumitrach
// Copyright (C) 2012 Nicolae Dumitrache
17 2 ndumitrach
// 
18
// This source file may be used and distributed without 
19
// restriction provided that this copyright statement is not 
20
// removed from the file and that any derivative work contains 
21
// the original copyright notice and the associated disclaimer.
22
// 
23
// This source file is free software; you can redistribute it 
24
// and/or modify it under the terms of the GNU Lesser General 
25
// Public License as published by the Free Software Foundation;
26
// either version 2.1 of the License, or (at your option) any 
27
// later version. 
28
// 
29
// This source is distributed in the hope that it will be 
30
// useful, but WITHOUT ANY WARRANTY; without even the implied 
31
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
32
// PURPOSE. See the GNU Lesser General Public License for more 
33
// details. 
34
// 
35
// You should have received a copy of the GNU Lesser General 
36
// Public License along with this source; if not, download it 
37
// from http://www.opencores.org/lgpl.shtml 
38
// 
39
///////////////////////////////////////////////////////////////////////////////////
40
//
41
// Comments:
42
// This project was developed and tested on a XILINX Spartan3AN board.
43
//
44
//      This is a demonstration system containing:
45
//              - Next80186 CPU
46
//              - Next80186 BIU - 32bit bus, 80Mhz
47
//              - 4KB SRAM (2KB at address 00000h - interrupt table zone, 2KB at address FF800h - ROM zone)
48
//              - 1DCM with 50Mhz input and 80Mhz output
49
//      The system is connected to RS232, to 9 LEDs on board and to a RESET button. 
50
//
51
///////////////////////////////////////////////////////////////////////////////////
52
`timescale 1ns / 1ps
53
 
54
module system(
55
//              output [17:0]RAM_ADDR,
56
//              output CE,
57
//              output [3:0]RAM_WMASK,
58
//              output RAM_MREQ, 
59
//              output RAM_WR,
60
//              output [31:0]RAM_DIN,
61
//              output [31:0]RAM_DOUT,
62
//              output [47:0]INSTR,
63
//              output IFETCH,
64
//              output FLUSH,
65
//              output MREQ,
66
//              output WR,
67
//              output WORD,
68
//              output [19:0]ADDR,
69
//              output [19:0]IADDR,
70
//              output [15:0]DIN,
71
//              output [15:0]DOUT,
72
//              output [2:0]ISIZE,
73
//              output HALT,
74
//              output IORQ,
75
 
76
                input CLK_50MHZ,
77
                input BTN_SOUTH,
78
                output reg[7:0]LED,
79
                output FPGA_AWAKE,      // HALT
80
                input RS232_DCE_RXD,
81
                output reg RS232_DCE_TXD
82
    );
83
 
84
 
85
        wire [19:0]ADDR;
86
        wire [19:0]IADDR;
87
        wire [15:0]DIN;
88
        wire [15:0]DOUT;
89
        wire [47:0]INSTR;
90
        wire [2:0]ISIZE;
91
        wire [31:0]RAM_DIN;
92
        wire [31:0]RAM_DOUT;
93
        wire [17:0]RAM_ADDR;
94
        wire [3:0] RAM_WMASK;
95
        wire RAM_MREQ;
96
        wire CE;
97
        wire MREQ;
98
        wire WR;
99
        wire WORD;
100
        wire IFETCH;
101
        wire FLUSH;
102
        wire HALT;
103
        wire IORQ;
104
 
105
        reg s_RS232_DCE_RXD;
106
        wire CLK;
107
        reg [4:0]rstcount = 0;
108
 
109
        Next186_CPU CPU186
110
        (
111
                 .ADDR(ADDR),
112
                 .DIN({DIN[15:1], IORQ ? s_RS232_DCE_RXD : DIN[0]}),
113
                 .DOUT(DOUT),
114
                 .CLK(CLK),
115
                 .CE(CE),
116
                 .INTR(1'b0),
117
                 .NMI(1'b0),
118
                 .RST(BTN_SOUTH || !rstcount[4]),
119
                 .MREQ(MREQ),
120
                 .IORQ(IORQ),
121
//               .INTA(INTA), 
122
                 .WR(WR),
123
                 .WORD(WORD),
124
//               .LOCK(LOCK), 
125
                 .IADDR(IADDR),
126
                 .INSTR(INSTR),
127
                 .IFETCH(IFETCH),
128
                 .FLUSH(FLUSH),
129
                 .ISIZE(ISIZE),
130
                 .HALT(FPGA_AWAKE)
131
         );
132
 
133
         BIU186_32bSync_2T_DelayRead BIU186
134
         (
135
                 .CLK(CLK),
136
                 .INSTR(INSTR),
137
                 .ISIZE(ISIZE),
138
                 .IFETCH(IFETCH),
139
                 .FLUSH(FLUSH),
140
                 .MREQ(MREQ),
141
                 .WR(WR),
142
                 .WORD(WORD),
143
                 .ADDR(ADDR),
144
                 .IADDR(IADDR),
145
                 .CE186(CE),
146
                 .RAM_DIN(RAM_DIN),
147
                 .RAM_DOUT(RAM_DOUT),
148
                 .RAM_ADDR(RAM_ADDR),
149
                 .RAM_MREQ(RAM_MREQ),
150
                 .RAM_WMASK(RAM_WMASK),
151
                 .DOUT(DIN),
152
                 .DIN(DOUT),
153
                 .CE(1'b1)
154
    );
155
 
156
         wire block0 = RAM_ADDR[17:9] == 9'b000000000;
157
         wire block1 = RAM_ADDR[17:9] == 9'b111111111;
158
 
159
         sram SRAM_
160
         (
161
                  .clka(CLK), // input clka
162
                  .ena(RAM_MREQ && (block0 || block1)), // input ena
163
                  .wea(RAM_WMASK), // input [3 : 0] wea
164
                  .addra(RAM_ADDR[9:0]), // input [9 : 0] addra
165
                  .dina(RAM_DOUT), // input [31 : 0] dina
166
                  .douta(RAM_DIN) // output [31 : 0] douta
167
          );
168
 
169
        dcm system_clock
170
        (
171
    .CLKIN_IN(CLK_50MHZ),
172
    .CLKFX_OUT(CLK)
173
//    .CLKIN_IBUFG_OUT(CLKIN_IBUFG_OUT), 
174
//    .CLK0_OUT(CLK0_OUT)
175
    );
176
 
177
 
178
                always @ (posedge CLK) begin
179
                        if(CE && IORQ && WR) begin
180
                                if(ADDR[0]) RS232_DCE_TXD <= DOUT[0];
181
                                else LED <= DOUT[7:0];
182
                        end
183
                        s_RS232_DCE_RXD <= RS232_DCE_RXD;
184
                        if(CE && ~rstcount[4]) rstcount <= rstcount + 1;
185
                end
186
endmodule

powered by: WebSVN 2.1.0

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