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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [memory/] [icache_matched.v] - Blame information for rev 6

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

Line No. Rev Author Line
1 2 alfik
/*
2
 * Copyright (c) 2014, Aleksander Osman
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * * Redistributions of source code must retain the above copyright notice, this
9
 *   list of conditions and the following disclaimer.
10
 *
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 *   this list of conditions and the following disclaimer in the documentation
13
 *   and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
 
27
`include "defines.v"
28
 
29
module icache_matched(
30
 
31
    input [31:0]    address,
32
 
33
    input [6:0]     control,
34
    input [147:0]   data_0,
35
    input [147:0]   data_1,
36
    input [147:0]   data_2,
37
    input [147:0]   data_3,
38
 
39
 
40
    output          matched,
41
    output [127:0]  matched_data_line,
42
 
43
    output [1:0]    plru_index,
44
 
45
    output [6:0]    control_after_invalidate_write,
46
    output [6:0]    control_after_match,
47
    output [6:0]    control_after_line_read
48
);
49
 
50
//------------------------------------------------------------------------------
51
 
52
wire [2:0] matched_index;
53
 
54
//------------------------------------------------------------------------------
55
 
56
assign matched_index =
57
    (control[0] && data_0[147:128] == address[31:12])? 3'd0 :
58
    (control[1] && data_1[147:128] == address[31:12])? 3'd1 :
59
    (control[2] && data_2[147:128] == address[31:12])? 3'd2 :
60
    (control[3] && data_3[147:128] == address[31:12])? 3'd3 :
61
                                                       3'd4;
62
assign matched = matched_index != 3'd4;
63
 
64
assign matched_data_line =
65
    (matched_index == 3'd0)? data_0[127:0] :
66
    (matched_index == 3'd1)? data_1[127:0] :
67
    (matched_index == 3'd2)? data_2[127:0] :
68
                             data_3[127:0];
69
 
70
assign control_after_invalidate_write =
71
    (matched_index == 3'd0)?  { control[6], 2'b11,      control[3:0] & 4'b1110 } :
72
    (matched_index == 3'd1)?  { control[6], 2'b01,      control[3:0] & 4'b1101 } :
73
    (matched_index == 3'd2)?  { 1'b1, control[5], 1'b0, control[3:0] & 4'b1011 } :
74
                              { 1'b0, control[5], 1'b0, control[3:0] & 4'b0111 };
75
 
76
assign control_after_match =
77
    (matched_index == 3'd0)?  { control[6], 2'b11,      control[3:0] } :
78
    (matched_index == 3'd1)?  { control[6], 2'b01,      control[3:0] } :
79
    (matched_index == 3'd2)?  { 1'b1, control[5], 1'b0, control[3:0] } :
80
                              { 1'b0, control[5], 1'b0, control[3:0] };
81
 
82
assign control_after_line_read =
83
    (~(control[0]))?        { control[6], 2'b11,      control[3:0] | 4'b0001 } :
84
    (~(control[1]))?        { control[6], 2'b01,      control[3:0] | 4'b0010 } :
85
    (~(control[2]))?        { 1'b1, control[5], 1'b0, control[3:0] | 4'b0100 } :
86
    (~(control[3]))?        { 1'b0, control[5], 1'b0, control[3:0] | 4'b1000 } :
87
    (plru_index == 2'd0)?   { control[6], 2'b11,      control[3:0] } :
88
    (plru_index == 2'd1)?   { control[6], 2'b01,      control[3:0] } :
89
    (plru_index == 2'd2)?   { 1'b1, control[5], 1'b0, control[3:0] } :
90
                            { 1'b0, control[5], 1'b0, control[3:0] }; //match icache_ram_3_q[]
91
 
92
assign plru_index =
93
    (~(control[0]))?                    2'd0 :
94
    (~(control[1]))?                    2'd1 :
95
    (~(control[2]))?                    2'd2 :
96
    (~(control[3]))?                    2'd3 :
97
    (~(control[4]) && ~(control[5]))?   2'd0 :
98
    (~(control[4]) &&  (control[5]))?   2'd1 :
99
    ( (control[4]) && ~(control[6]))?   2'd2 :
100
                                        2'd3; // ( (control[4]) &&  (control[6]))?
101
 
102
//------------------------------------------------------------------------------
103
 
104
//------------------------------------------------------------------------------
105
 
106
// synthesis translate_off
107
wire _unused_ok = &{ 1'b0, address[11:0], 1'b0 };
108
// synthesis translate_on
109
 
110
//------------------------------------------------------------------------------
111
 
112
endmodule

powered by: WebSVN 2.1.0

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