Subversion Repositories pentevo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 lvd 1
// part of NewGS project (c) 2007 NedoPC
2
//
3
// ramtest
4
 
5
module main(
6
 
7
        clk_fpga,  // clocks
8
        clk_24mhz, //
9
 
10
        clksel0, // clock selection
11
        clksel1, //
12
 
13
        warmres_n, // warm reset
14
 
15
 
16
        d, // Z80 data bus
17
        a, // Z80 address bus
18
 
19
        iorq_n,   // Z80 control signals
20
        mreq_n,   //
21
        rd_n,     //
22
        wr_n,     //
23
        m1_n,     //
24
        int_n,    //
25
        nmi_n,    //
26
        busrq_n,  //
27
        busak_n,  //
28
        z80res_n, //
29
 
30
 
31
        mema14,   // memory control
32
        mema15,   //
33
        mema16,   //
34
        mema17,   //
35
        mema18,   //
36
        ram0cs_n, //
37
        ram1cs_n, //
38
        ram2cs_n, //
39
        ram3cs_n, //
40
        romcs_n,  //
41
        memoe_n,  //
42
        memwe_n,  //
43
 
44
 
45
        zxid,        // zxbus signals
46
        zxa,         //
47
        zxa14,       //
48
        zxa15,       //
49
        zxiorq_n,    //
50
        zxmreq_n,    //
51
        zxrd_n,      //
52
        zxwr_n,      //
53
        zxcsrom_n,   //
54
        zxblkiorq_n, //
55
        zxblkrom_n,  //
56
        zxgenwait_n, //
57
        zxbusin,     //
58
        zxbusena_n,  //
59
 
60
 
61
        dac_bitck, // audio-DAC signals
62
        dac_lrck,  //
63
        dac_dat,  //
64
 
65
 
66
        sd_clk, // SD card interface
67
        sd_cs,  //
68
        sd_do,  //
69
        sd_di,  //
70
        sd_wp,  //
71
        sd_det, //
72
 
73
 
74
        ma_clk, // control interface of MP3 chip
75
        ma_cs,
76
        ma_do,
77
        ma_di,
78
 
79
        mp3_xreset, // data interface of MP3 chip
80
        mp3_req,    //
81
        mp3_clk,    //
82
        mp3_dat,    //
83
        mp3_sync,   //
84
 
85
        led_diag
86
);
87
 
88
 
89
// input-output description
90
 
91
        input clk_fpga;
92
        input clk_24mhz;
93
 
94
        output clksel0; reg clksel0;
95
        output clksel1; reg clksel1;
96
 
97
 
98
        input warmres_n;
99
 
100
        inout  [7:0] d;// reg [7:0] d;
101
///////////////////////////////////////////////////////////     input [15:0] a;
102
        output [15:0] a; wire [15:0] a;
103
 
104
        input iorq_n;
105
        input mreq_n;
106
        input rd_n;
107
        input wr_n;
108
        input m1_n;
109
        output int_n; wire int_n;
110
        output nmi_n; wire nmi_n;
111
        output busrq_n; wire busrq_n;
112
        input busak_n;
113
        output z80res_n; reg z80res_n;
114
 
115
 
116
        output mema14; wire mema14;
117
        output mema15; wire mema15;
118
        output mema16; wire mema16;
119
        output mema17; wire mema17;
120
        output mema18; wire mema18;
121
        output ram0cs_n; wire ram0cs_n;
122
        output ram1cs_n; wire ram1cs_n;
123
        output ram2cs_n; wire ram2cs_n;
124
        output ram3cs_n; wire ram3cs_n;
125
        output romcs_n; wire romcs_n;
126
        output memoe_n; wire memoe_n;
127
        output memwe_n; wire memwe_n;
128
 
129
 
130
        inout [7:0] zxid; wire [7:0] zxid;
131
        input [7:0] zxa;
132
        input zxa14;
133
        input zxa15;
134
        input zxiorq_n;
135
        input zxmreq_n;
136
        input zxrd_n;
137
        input zxwr_n;
138
        input zxcsrom_n;
139
        output zxblkiorq_n; wire zxblkiorq_n;
140
        output zxblkrom_n; wire zxblkrom_n;
141
        output zxgenwait_n; wire zxgenwait_n;
142
        output zxbusin; wire zxbusin;
143
        output zxbusena_n; wire zxbusena_n;
144
 
145
 
146
        output dac_bitck; wire dac_bitck;
147
        output dac_lrck; wire dac_lrck;
148
        output dac_dat; wire dac_dat;
149
 
150
 
151
        output sd_clk; wire sd_clk;
152
        output sd_cs; wire sd_cs;
153
        output sd_do; wire sd_do;
154
        input sd_di;
155
        input sd_wp;
156
        input sd_det;
157
 
158
 
159
        output ma_clk; wire ma_clk;
160
        output ma_cs; wire ma_cs;
161
        output ma_do; wire ma_do;
162
        input ma_di;
163
 
164
        output mp3_xreset; wire mp3_xreset;
165
        input mp3_req;
166
        output mp3_clk; wire mp3_clk;
167
        output mp3_dat; wire mp3_dat;
168
        output mp3_sync; wire mp3_sync;
169
 
170
        output led_diag;
171
 
172
        always @* clksel0 <= 1'b0;
173
        always @* clksel1 <= 1'b0;
174
 
175
        always @* z80res_n <= 1'b0;
176
 
177
        assign busrq_n = 1'b1;
178
        assign int_n = 1'b1;
179
        assign nmi_n = 1'b1;
180
 
181
        assign romcs_n = 1'b1;
182
 
183
        assign zxid=8'bZZZZZZZZ;
184
        assign zxblkrom_n=1'b1;
185
        assign zxgenwait_n=1'b1;
186
        assign zxbusin=1'b1;
187
        assign zxbusena_n=1'b1;
188
 
189
        assign dac_bitck = 1'b1;
190
        assign dac_lrck = 1'b1;
191
        assign dac_dat = 1'b1;
192
 
193
        assign sd_clk = 1'b0;
194
        assign sd_cs = 1'b1;
195
        assign sd_do = 1'b0;
196
 
197
        assign ma_clk = 1'b0;
198
        assign ma_cs = 1'b1;
199
        assign ma_do = 1'b0;
200
        assign mp3_xreset = 1'b0;
201
        assign mp3_clk = 1'b0;
202
        assign mp3_dat = 1'b0;
203
        assign mp3_sync= 1'b0;
204
 
205
//////////////////////////////////////////////////////////////////////////////////
206
//////////////////////////////////////////////////////////////////////////////////
207
//////////////////////////////////////////////////////////////////////////////////
208
 
209
 
210
        wire rst_zx = (zxa[7:0]==8'h33) & (~zxiorq_n) & (~zxwr_n);
211
        assign zxblkiorq_n = ~(zxa[7:0]==8'h33);
212
 
213
        wire rst_n;
214
        resetter myreset( .clk(clk_fpga), .rst_in_n( warmres_n & (~rst_zx) ), .rst_out_n(rst_n) );
215
 
216
 
217
        wire sel0,sel1;
218
        wire ramce;
219
 
220
        mem_tester mytst( .clk(clk_fpga), .rst_n(rst_n), .led(led_diag),
221
                          .SRAM_DQ(d), .SRAM_ADDR( {sel1,sel0,mema18,mema17,mema16,mema15,mema14,a[13:0]} ),
222
                          .SRAM_WE_N( memwe_n ), .SRAM_OE_N( memoe_n ), .SRAM_CE_N( ramce ) );
223
        defparam mytst.SRAM_ADDR_SIZE = 21;
224
 
225
 
226
        assign ram0cs_n = ( {sel1,sel0}==2'd0 )?ramce:1'b1;
227
        assign ram1cs_n = ( {sel1,sel0}==2'd1 )?ramce:1'b1;
228
        assign ram2cs_n = ( {sel1,sel0}==2'd2 )?ramce:1'b1;
229
        assign ram3cs_n = ( {sel1,sel0}==2'd3 )?ramce:1'b1;
230
 
231
 
232
 
233
 
234
 
235
 
236
endmodule