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

Subversion Repositories mpmc8

[/] [mpmc8/] [trunk/] [rtl/] [mpmc8_data_output.sv] - Blame information for rev 7

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

Line No. Rev Author Line
1 2 robfinch
`timescale 1ns / 1ps
2
// ============================================================================
3
//        __
4
//   \\__/ o\    (C) 2015-2022  Robert Finch, Waterloo
5
//    \  __ /    All rights reserved.
6
//     \/_//     robfinch@finitron.ca
7
//       ||
8
//
9
// BSD 3-Clause License
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are met:
12
//
13
// 1. Redistributions of source code must retain the above copyright notice, this
14
//    list of conditions and the following disclaimer.
15
//
16
// 2. Redistributions in binary form must reproduce the above copyright notice,
17
//    this list of conditions and the following disclaimer in the documentation
18
//    and/or other materials provided with the distribution.
19
//
20
// 3. Neither the name of the copyright holder nor the names of its
21
//    contributors may be used to endorse or promote products derived from
22
//    this software without specific prior written permission.
23
//
24
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
//
35
// ============================================================================
36
//
37
import mpmc8_pkg::*;
38
 
39
module mpmc8_data_output(
40
        clk0, cs0, adr0, ch0_rdat, dato0,
41
        clk1, cs1, adr1, ch1_rdat, dato1,
42
        clk2, cs2, adr2, ch2_rdat, dato2,
43
        clk3, cs3, adr3, ch3_rdat, dato3,
44
        clk4, cs4, adr4, ch4_rdat, dato4,
45
        clk5, cs5, adr5, ch5_rdat, dato5,
46
        clk6, cs6, adr6, ch6_rdat, dato6,
47
        clk7, cs7, adr7, ch7_rdat, dato7
48
);
49
parameter C0W = 128;
50
parameter C1W = 128;
51
parameter C2W = 32;
52
parameter C3W = 16;
53
parameter C4W = 128;
54
parameter C5W = 64;
55
parameter C6W = 128;
56
parameter C7R = 16;
57
 
58
input clk0;
59
input clk1;
60
input clk2;
61
input clk3;
62
input clk4;
63
input clk5;
64
input clk6;
65
input clk7;
66
input cs0;
67
input cs1;
68
input cs2;
69
input cs3;
70
input cs4;
71
input cs5;
72
input cs6;
73
input cs7;
74
input [31:0] adr0;
75
input [31:0] adr1;
76
input [31:0] adr2;
77
input [31:0] adr3;
78
input [31:0] adr4;
79
input [31:0] adr5;
80
input [31:0] adr6;
81
input [31:0] adr7;
82
input [127:0] ch0_rdat;
83
input [127:0] ch1_rdat;
84
input [127:0] ch2_rdat;
85
input [127:0] ch3_rdat;
86
input [127:0] ch4_rdat;
87
input [127:0] ch5_rdat;
88
input [127:0] ch6_rdat;
89
input [127:0] ch7_rdat;
90
output reg [127:0] dato0;
91
output reg [127:0] dato1;
92
output reg [127:0] dato2;
93
output reg [127:0] dato3;
94
output reg [127:0] dato4;
95
output reg [127:0] dato5;
96
output reg [127:0] dato6;
97
output reg [127:0] dato7;
98
 
99
reg [127:0] ch0_rdatr;
100
reg [127:0] ch1_rdatr;
101
reg [127:0] ch2_rdatr;
102
reg [127:0] ch3_rdatr;
103
reg [127:0] ch4_rdatr;
104
reg [127:0] ch5_rdatr;
105
reg [127:0] ch6_rdatr;
106
reg [127:0] ch7_rdatr;
107
 
108
// Setting output data. Force output data to zero when not selected to allow
109
// wire-oring the data.
110
always_ff @(posedge clk0)
111
`ifdef RED_SCREEN
112
if (cs0) begin
113
        if (C0W==128)
114
                dato0 <= 128'h7C007C007C007C007C007C007C007C00;
115
        else if (C0W==64)
116
                dato0 <= 64'h7C007C007C007C00;
117
        else if (C0W==32)
118
                dato0 <= 32'h7C007C00;
119
        else if (C0W==16)
120
                dato0 <= 16'h7C00;
121
        else
122
                dato0 <= 8'hE0;
123
end
124
else
125
        dato0 <= {C0W{1'b0}};
126
`else
127
        tDato(C0W,cs0,adr0[3:0],ch0_rdatr,dato0);
128
`endif
129
 
130
// Register data outputs back onto their domain.
131
always_ff @(posedge clk1)
132
        ch1_rdatr <= ch1_rdat;
133
always_ff @(posedge clk2)
134
        ch2_rdatr <= ch2_rdat;
135
always_ff @(posedge clk3)
136
        ch3_rdatr <= ch3_rdat;
137
always_ff @(posedge clk4)
138
        ch4_rdatr <= ch4_rdat;
139
always_ff @(posedge clk5)
140
        ch5_rdatr <= ch5_rdat;
141
always_ff @(posedge clk6)
142
        ch6_rdatr <= ch6_rdat;
143
always_ff @(posedge clk7)
144
        ch7_rdatr <= ch7_rdat;
145
always_ff @(posedge clk0)
146
        ch0_rdatr <= ch0_rdat;
147
 
148
always_ff @(posedge clk1)
149
        tDato(C1W,cs1,adr1[3:0],ch1_rdatr,dato1);
150
always_ff @(posedge clk2)
151
        tDato(C2W,cs2,adr2[3:0],ch2_rdatr,dato2);
152
always_ff @(posedge clk3)
153
        tDato(C3W,cs3,adr3[3:0],ch3_rdatr,dato3);
154
always_ff @(posedge clk4)
155
        tDato(C4W,cs4,adr4[3:0],ch4_rdatr,dato4);
156
always_ff @(posedge clk5)
157
        tDato(C5W,cs5,adr5[3:0],ch5_rdatr,dato5);
158
always_ff @(posedge clk6)
159
        tDato(C6W,cs6,adr6[3:0],ch6_rdatr,dato6);
160
always_ff @(posedge clk7)
161
        tDato(C7R,cs7,adr7[3:0],ch7_rdatr,dato7);
162
 
163
task tDato;
164
input [7:0] widi;
165
input csi;
166
input [3:0] adri;
167
input [127:0] dati;
168
output [127:0] dato;
169
begin
170
if (csi) begin
171
        if (widi==8'd128)
172
                dato <= dati;
173
        else if (widi==8'd64)
174
                dato <= dati >> {adri[3],6'h0};
175
        else if (widi==8'd32)
176
                dato <= dati >> {adri[3:2],5'h0};
177
        else if (widi==8'd16)
178
                dato <= dati >> {adri[3:1],4'h0};
179
        else
180
                dato <= dati >> {adri[3:0],3'h0};
181
end
182
else
183
        dato <= 'b0;
184
end
185
endtask
186
 
187
endmodule

powered by: WebSVN 2.1.0

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