mi_brom.v
2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// mi_brom.v v1 Frank Berndt
// mi boot rom;
// :set tabstop=4
module mi_brom (
sysclk,
brom_ena, brom_addr, brom_do
);
`include "define.vh"
input sysclk; // system clock;
input brom_ena; // rom enable;
input [13:2] brom_addr; // address;
output [31:0] brom_do; // read data;
`ifdef NEC_BROM
// instantiate one 4kx32 rom;
wire brom_csb = ~brom_ena;
WBROMSMHS4096W32C5N01 brom (
.DO0(brom_do[0]),
.DO1(brom_do[1]),
.DO2(brom_do[2]),
.DO3(brom_do[3]),
.DO4(brom_do[4]),
.DO5(brom_do[5]),
.DO6(brom_do[6]),
.DO7(brom_do[7]),
.DO8(brom_do[8]),
.DO9(brom_do[9]),
.DO10(brom_do[10]),
.DO11(brom_do[11]),
.DO12(brom_do[12]),
.DO13(brom_do[13]),
.DO14(brom_do[14]),
.DO15(brom_do[15]),
.DO16(brom_do[16]),
.DO17(brom_do[17]),
.DO18(brom_do[18]),
.DO19(brom_do[19]),
.DO20(brom_do[20]),
.DO21(brom_do[21]),
.DO22(brom_do[22]),
.DO23(brom_do[23]),
.DO24(brom_do[24]),
.DO25(brom_do[25]),
.DO26(brom_do[26]),
.DO27(brom_do[27]),
.DO28(brom_do[28]),
.DO29(brom_do[29]),
.DO30(brom_do[30]),
.DO31(brom_do[31]),
.A0(brom_addr[2]),
.A1(brom_addr[3]),
.A2(brom_addr[4]),
.A3(brom_addr[5]),
.A4(brom_addr[6]),
.A5(brom_addr[7]),
.A6(brom_addr[8]),
.A7(brom_addr[9]),
.A8(brom_addr[10]),
.A9(brom_addr[11]),
.A10(brom_addr[12]),
.A11(brom_addr[13]),
.BE(sysclk),
.CSB(brom_csb),
.TDO0(),
.TDO1(),
.TDO2(),
.TDO3(),
.TDO4(),
.TDO5(),
.TDO6(),
.TDO7(),
.TDO8(),
.TDO9(),
.TDO10(),
.TDO11(),
.TDO12(),
.TDO13(),
.TDO14(),
.TDO15(),
.TDO16(),
.TDO17(),
.TDO18(),
.TDO19(),
.TDO20(),
.TDO21(),
.TDO22(),
.TDO23(),
.TDO24(),
.TDO25(),
.TDO26(),
.TDO27(),
.TDO28(),
.TDO29(),
.TDO30(),
.TDO31(),
.TA0(1'b0),
.TA1(1'b0),
.TA2(1'b0),
.TA3(1'b0),
.TA4(1'b0),
.TA5(1'b0),
.TA6(1'b0),
.TA7(1'b0),
.TA8(1'b0),
.TA9(1'b0),
.TA10(1'b0),
.TA11(1'b0),
.TBE(1'b0),
.BUNRI(1'b0),
.TEST(1'b0)
);
`else // NEC_BROM
// behavioral code;
reg [31:0] brom [0:2047]; // 8kbytes of brom;
reg brom_xena;
reg [12:2] brom_xaddr;
initial
begin
$display("%M: behavioral brom");
$readmemh("tests/brom.dat", brom);
end
always @(posedge sysclk)
begin
brom_xena <= brom_ena;
brom_xaddr <= mi_addr[12:2];
end
assign brom_do = brom_xena? brom[brom_xaddr] : 32'bx;
`endif // NEC_BROM
endmodule