1 |
4 |
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 mpmc9_pkg::*;
|
38 |
|
|
|
39 |
|
|
module mpmc9_addr_select(rst, clk, state, ch,
|
40 |
|
|
adr0, adr1, adr2, adr3, adr4, adr5, adr6, adr7,
|
41 |
|
|
adr);
|
42 |
|
|
input rst;
|
43 |
|
|
input clk;
|
44 |
|
|
input [3:0] state;
|
45 |
|
|
input [3:0] ch;
|
46 |
|
|
input [31:0] adr0;
|
47 |
|
|
input [31:0] adr1;
|
48 |
|
|
input [31:0] adr2;
|
49 |
|
|
input [31:0] adr3;
|
50 |
|
|
input [31:0] adr4;
|
51 |
|
|
input [31:0] adr5;
|
52 |
|
|
input [31:0] adr6;
|
53 |
|
|
input [31:0] adr7;
|
54 |
|
|
output reg [31:0] adr;
|
55 |
|
|
|
56 |
|
|
// Select the address input
|
57 |
|
|
reg [31:0] adrx;
|
58 |
|
|
always_ff @(posedge clk)
|
59 |
|
|
if (state==IDLE) begin
|
60 |
|
|
case(ch)
|
61 |
|
|
3'd0: adrx <= {adr0[AMSB:4],4'h0};
|
62 |
|
|
3'd1: adrx <= {adr1[AMSB:4],4'h0};
|
63 |
|
|
3'd2: adrx <= {adr2[AMSB:4],4'h0};
|
64 |
|
|
3'd3: adrx <= {adr3[AMSB:4],4'h0};
|
65 |
|
|
3'd4: adrx <= {adr4[AMSB:4],4'h0};
|
66 |
|
|
3'd5: adrx <= {adr5[AMSB:4],4'h0};
|
67 |
|
|
3'd6: adrx <= {adr6[AMSB:4],4'h0};
|
68 |
|
|
3'd7: adrx <= {adr7[AMSB:4],4'h0};
|
69 |
|
|
default: adrx <= 29'h1FFFFFF0;
|
70 |
|
|
endcase
|
71 |
|
|
end
|
72 |
|
|
always_ff @(posedge clk)
|
73 |
|
|
if (rst)
|
74 |
|
|
adr <= 32'h1FFFFFF0;
|
75 |
|
|
else if (state==PRESET1)
|
76 |
|
|
adr <= adrx;
|
77 |
|
|
|
78 |
|
|
endmodule
|