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_set_num_strips(clk, state, ch,
|
40 |
|
|
we0, we1, we2, we3, we4, we5, we6, we7, num_strips);
|
41 |
|
|
parameter S0 = 3'd7;
|
42 |
|
|
parameter S1 = 3'd1;
|
43 |
|
|
parameter S2 = 3'd0;
|
44 |
|
|
parameter S3 = 3'd0;
|
45 |
|
|
parameter S4 = 3'd0;
|
46 |
|
|
parameter S5 = 3'd3;
|
47 |
|
|
parameter S6 = 3'd0;
|
48 |
|
|
parameter S7 = 3'd3;
|
49 |
|
|
input clk;
|
50 |
|
|
input [3:0] state;
|
51 |
|
|
input [3:0] ch;
|
52 |
|
|
input we0;
|
53 |
|
|
input we1;
|
54 |
|
|
input we2;
|
55 |
|
|
input we3;
|
56 |
|
|
input we4;
|
57 |
|
|
input we5;
|
58 |
|
|
input we6;
|
59 |
|
|
input we7;
|
60 |
|
|
output reg [2:0] num_strips;
|
61 |
|
|
|
62 |
|
|
// Setting burst length
|
63 |
|
|
always_ff @(posedge clk)
|
64 |
|
|
if (state==IDLE) begin
|
65 |
|
|
num_strips <= 3'd0;
|
66 |
|
|
case(ch)
|
67 |
|
|
4'd0: if (!we0) num_strips <= S0; //7
|
68 |
|
|
4'd1: if (!we1) num_strips <= S1; //1
|
69 |
|
|
4'd2: if (!we2) num_strips <= S2;
|
70 |
|
|
4'd3: if (!we3) num_strips <= S3;
|
71 |
|
|
4'd4: if (!we4) num_strips <= S4;
|
72 |
|
|
4'd5: if (!we5) num_strips <= S5; //3
|
73 |
|
|
4'd6: if (!we6) num_strips <= S6;
|
74 |
|
|
4'd7: if (!we7) num_strips <= S7;
|
75 |
|
|
default: ;
|
76 |
|
|
endcase
|
77 |
|
|
end
|
78 |
|
|
|
79 |
|
|
endmodule
|