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

Subversion Repositories thor

[/] [thor/] [trunk/] [bench/] [Thor_tb.v] - Blame information for rev 16

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

Line No. Rev Author Line
1 2 robfinch
 
2
module Thor_tb();
3
parameter DBW=32;
4
reg rst;
5
reg clk;
6
reg nmi;
7
reg p100Hz;
8
wire [2:0] cti;
9
wire cpu_clk;
10
wire cyc;
11
wire stb;
12
wire we;
13
wire [7:0] sel;
14
wire br_ack;
15
wire [31:0] adr;
16
wire [DBW-1:0] br_dato;
17
wire scr_ack;
18
wire [63:0] scr_dato;
19
 
20
wire cpu_ack;
21
wire [DBW-1:0] cpu_dati;
22
wire [DBW-1:0] cpu_dato;
23
wire pic_ack,irq;
24
wire [31:0] pic_dato;
25
wire [7:0] vecno;
26
 
27
wire LEDS_ack;
28
 
29
initial begin
30
        #0 rst = 1'b0;
31
        #0 clk = 1'b0;
32
        #0 nmi = 1'b0;
33
        #0 p100Hz = 1'b0;
34
        #10 rst = 1'b1;
35
        #50 rst = 1'b0;
36
        #19550 nmi = 1'b1;
37
        #20 nmi = 1'b0;
38
end
39
 
40
always #5 clk = ~clk;
41
always #10000 p100Hz = ~p100Hz;
42
 
43
assign LEDS_ack = cyc && stb && adr[31:8]==32'hFFDC06;
44
always @(posedge clk)
45
        if (LEDS_ack)
46
                $display("LEDS: %b", cpu_dato[7:0]);
47
 
48
wire tc1_ack, tc2_ack;
49
wire kbd_ack;
50
wire [31:0] tc1_dato, tc2_dato;
51
wire [7:0] kbd_dato;
52
 
53
//wire cs0 = cyc&& stb && adr[31:16]==16'h0000;
54
 
55
assign cpu_ack =
56
        LEDS_ack |
57
        scr_ack |
58
        br_ack |
59
        tc1_ack | tc2_ack |
60
        kbd_ack | pic_ack
61
        ;
62
assign cpu_dati =
63
        scr_dato |
64
        br_dato |
65
        tc1_dato | tc2_dato |
66
        {4{kbd_dato}} |
67
        pic_dato
68
        ;
69
 
70
Ps2Keyboard_sim ukbd
71
(
72
    .rst_i(rst),
73
    .clk_i(cpu_clk),
74
    .cyc_i(cyc),
75
    .stb_i(stb),
76
    .ack_o(kbd_ack),
77
    .we_i(we),
78
    .adr_i(adr),
79
    .dat_i(cpu_dato),
80
    .dat_o(kbd_dato),
81
    .kclk(),
82
    .kd(),
83
    .irq_o()
84
);
85
 
86
rtfTextController3 #(.num(1), .pTextAddress(32'hFFD00000))  tc1
87
(
88
        .rst_i(rst),
89
        .clk_i(cpu_clk),
90
        .cyc_i(cyc),
91
        .stb_i(stb),
92
        .ack_o(tc1_ack),
93
        .we_i(we),
94
        .adr_i(adr),
95
        .dat_i(cpu_dato),
96
        .dat_o(tc1_dato),
97
        .lp(),
98
        .curpos(),
99
        .vclk(),
100
        .hsync(),
101
        .vsync(),
102
        .blank(),
103
        .border(),
104
        .rgbIn(),
105
        .rgbOut()
106
);
107
 
108
rtfTextController3 #(.num(1), .pTextAddress(32'hFFD10000))  tc2
109
(
110
        .rst_i(rst),
111
        .clk_i(cpu_clk),
112
        .cyc_i(cyc),
113
        .stb_i(stb),
114
        .ack_o(tc2_ack),
115
        .we_i(we),
116
        .adr_i(adr),
117
        .dat_i(cpu_dato),
118
        .dat_o(tc2_dato),
119
        .lp(),
120
        .curpos(),
121
        .vclk(),
122
        .hsync(),
123
        .vsync(),
124
        .blank(),
125
        .border(),
126
        .rgbIn(),
127
        .rgbOut()
128
);
129
 
130
scratchmem32 #(DBW) uscrm1
131
(
132
        .rst_i(rst),
133
        .clk_i(cpu_clk),
134
        .cyc_i(cyc),
135
        .stb_i(stb),
136
        .ack_o(scr_ack),
137
        .we_i(we),
138
        .sel_i(sel),
139
        .adr_i({32'd0,adr}),
140
        .dat_i(cpu_dato),
141
        .dat_o(scr_dato)
142
);
143
 
144
bootrom #(DBW) ubr1
145
(
146
        .rst_i(rst),
147
        .clk_i(cpu_clk),
148
        .cti_i(cti),
149
        .cyc_i(cyc),
150
        .stb_i(stb),
151
        .ack_o(br_ack),
152
        .adr_i(adr),
153
        .dat_o(br_dato),
154
        .perr()
155
);
156
 
157
wire nmio;
158
Thor_pic upic1
159
(
160
        .rst_i(rst),            // reset
161
        .clk_i(cpu_clk),        // system clock
162
        .cyc_i(cyc),    // cycle valid
163
        .stb_i(stb),    // strobe
164
    .ack_o(pic_ack),    // transfer acknowledge
165
        .we_i(we),              // write
166
        .adr_i(adr),    // address
167
        .dat_i(cpu_dato),
168
        .dat_o(pic_dato),
169
        .vol_o(),               // volatile register selected
170
        .i1(),
171
        .i2(p100Hz),
172
        .i3(),
173
        .i4(),
174
        .i5(),
175
        .i6(),
176
        .i7(),
177
        .i8(),
178
        .i9(),
179
        .i10(),
180
        .i11(),
181
        .i12(),
182
        .i13(),
183
        .i14(),
184
        .i15(),
185
        .irqo(irq),     // normally connected to the processor irq
186
        .nmii(nmi),             // nmi input connected to nmi requester
187
        .nmio(nmio),    // normally connected to the nmi of cpu
188
        .vecno(vecno)
189
);
190
 
191
Thor #(DBW) uthor1
192
(
193
        .rst_i(rst),
194
        .clk_i(clk),
195
        .clk_o(cpu_clk),
196
        .nmi_i(nmio),
197
        .irq_i(irq),
198
        .vec_i(vecno),
199
        .bte_o(),
200
        .cti_o(cti),
201
        .bl_o(),
202
        .cyc_o(cyc),
203
        .stb_o(stb),
204
        .ack_i(cpu_ack),
205
        .err_i(1'b0),
206
        .we_o(we),
207
        .sel_o(sel),
208
        .adr_o(adr),
209
        .dat_i(cpu_dati),
210
        .dat_o(cpu_dato)
211
);
212
 
213
endmodule

powered by: WebSVN 2.1.0

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