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

Subversion Repositories mpmc8

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

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

Line No. Rev Author Line
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_mask_select(rst, clk, state, ch,
40
        wmask0, wmask1, wmask2, wmask3, wmask4, wmask5, wmask6, wmask7,
41
        mask, mask2
42
);
43
input rst;
44
input clk;
45
input [3:0] state;
46
input [3:0] ch;
47
input [15:0] wmask0;
48
input [15:0] wmask1;
49
input [15:0] wmask2;
50
input [15:0] wmask3;
51
input [15:0] wmask4;
52
input [15:0] wmask5;
53
input [15:0] wmask6;
54
input [15:0] wmask7;
55
output reg [15:0] mask;
56
output reg [15:0] mask2;
57
 
58
// Setting the data mask. Values are enabled when the data mask is zero.
59
always_ff @(posedge clk)
60
if (rst)
61
  mask2 <= 16'h0000;
62
else begin
63
        if (state==PRESET1)
64
                case(ch)
65
                4'd0:   mask2 <= wmask0;
66
                4'd1:   mask2 <= wmask1;
67
                4'd2:   mask2 <= wmask2;
68
                4'd3:   mask2 <= wmask3;
69
                4'd4:   mask2 <= wmask4;
70
                4'd5:   mask2 <= wmask5;
71
                4'd6:   mask2 <= wmask6;
72
                4'd7:   mask2 <= wmask7;
73
                default:        mask2 <= 16'h0000;
74
                endcase
75
        // For RMW cycle all bytes are writtten.
76
        else if (state==WRITE_TRAMP1)
77
                mask2 <= 16'h0000;
78
end
79
always_ff @(posedge clk)
80
if (rst)
81
  mask <= 16'h0000;
82
else begin
83
        if (state==PRESET2)
84
                mask <= mask2;
85
end
86
 
87
endmodule

powered by: WebSVN 2.1.0

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