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

Subversion Repositories oops

[/] [oops/] [trunk/] [rtl/] [icache_top.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 smjoshua
//////////////////////////////////////////////////////////////////
2
//                                                              //
3
//  OoOPs Core Instruction Cache module                         //
4
//                                                              //
5
//  This file is part of the OoOPs project                      //
6
//  http://www.opencores.org/project,oops                       //
7
//                                                              //
8
//  Description:                                                //
9
//  Top-level module for Instruction Cache block.  This includes//
10
//  the instantiation of the data and tag RAMs as well as the   //
11
//  cache controller logic.                                     //
12
//                                                              //
13
//  Author(s):                                                  //
14
//      - Joshua Smith, smjoshua@umich.edu                      //
15
//                                                              //
16
//////////////////////////////////////////////////////////////////
17
//                                                              //
18
// Copyright (C) 2012 Authors and OPENCORES.ORG                 //
19
//                                                              //
20
// This source file may be used and distributed without         //
21
// restriction provided that this copyright statement is not    //
22
// removed from the file and that any derivative work contains  //
23
// the original copyright notice and the associated disclaimer. //
24
//                                                              //
25
// This source file is free software; you can redistribute it   //
26
// and/or modify it under the terms of the GNU Lesser General   //
27
// Public License as published by the Free Software Foundation; //
28
// either version 2.1 of the License, or (at your option) any   //
29
// later version.                                               //
30
//                                                              //
31
// This source is distributed in the hope that it will be       //
32
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
33
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
34
// PURPOSE.  See the GNU Lesser General Public License for more //
35
// details.                                                     //
36
//                                                              //
37
// You should have received a copy of the GNU Lesser General    //
38
// Public License along with this source; if not, download it   //
39
// from http://www.opencores.org/lgpl.shtml                     //
40
//                                                              //
41
//////////////////////////////////////////////////////////////////
42
`include "ooops_defs.v"
43
 
44
module icache_top (
45
  input wire                    clk,
46
  input wire                    rst,
47
  input wire                    rob_pipe_flush,
48
 
49
  // Coprocessor interface
50
  input wire                    cp0_ic_enable,
51
 
52
  // IF interface
53
  input wire                    if_ic_req,
54
  input wire  [`ADDR_SZ-1:0]    if_ic_fpc,
55
  input wire  [`ADDR_SZ-1:0]    r_if_ic_fpc,
56
  output wire [`INSTR_SZ-1:0]   ic_if_data,
57
  output wire                   ic_if_data_valid,
58
  output wire                   ic_if_cache_hit,
59
  output wire                   ic_if_cache_miss,
60
  output wire                   ic_if_ready,
61
 
62
  // Memory interface
63
  output wire                   ic2bus_req,
64
  output wire [`ADDR_SZ-1:0]    ic2bus_fpc,
65
  input wire                    bus2ic_valid,
66
  input wire  [`SYS_BUS_SZ-1:0] bus2ic_data
67
  );
68
 
69
  // Internal wires
70
  wire  [`IC_SI_SZ-1:0]     ic_dataram_addr;
71
  wire  [`IC_LINE_SZ-1:0]   ic_dataram_data;
72
  wire  [`IC_LINE_SZ-1:0]   ic_dataram_wr_data;
73
  wire                      ic_dataram_wren;
74
 
75
  wire  [`IC_SI_SZ-1:0]     ic_tagram_addr;
76
  wire  [`IC_TAGRAM_SZ-1:0] ic_tagram_data;
77
  wire  [`IC_TAGRAM_SZ-1:0] ic_tagram_wr_data;
78
  wire                      ic_tagram_wren;
79
 
80
  // Instantiate IC controller
81
  icache_ctl icache_ctl0(
82
    .clk(clk),
83
    .rst(rst),
84
    .rob_pipe_flush(rob_pipe_flush),
85
    .cp0_ic_enable(cp0_ic_enable),
86
    .if_ic_req(if_ic_req),
87
    .if_ic_fpc(if_ic_fpc),
88
    .r_if_ic_fpc(r_if_ic_fpc),
89
    .ic_if_data(ic_if_data),
90
    .ic_if_data_valid(ic_if_data_valid),
91
    .ic_if_ready(ic_if_ready),
92
    .ic_tagram_data(ic_tagram_data),
93
    .ic_dataram_data(ic_dataram_data),
94
    .ic_dataram_wr_data(ic_dataram_wr_data),
95
    .ic_dataram_addr(ic_dataram_addr),
96
    .ic_dataram_wren(ic_dataram_wren),
97
    .ic_tagram_wr_data(ic_tagram_wr_data),
98
    .ic_tagram_addr(ic_tagram_addr),
99
    .ic_tagram_wren(ic_tagram_wren),
100
    .ic2bus_req(ic2bus_req),
101
    .ic2bus_fpc(ic2bus_fpc),
102
    .bus2ic_valid(bus2ic_valid),
103
    .bus2ic_data(bus2ic_data)
104
  );
105
 
106
  // Instantiate IC data and tag RAMs
107
  `ifdef USE_IC
108
  sp_sram #(.DW(`IC_LINE_SZ), .IW(`IC_SI_SZ)) d0 (
109
    .clk(clk),
110
    .addr(ic_dataram_addr),
111
    .wren(ic_dataram_wren),
112
    .din(ic_dataram_wr_data),
113
    .dout(ic_dataram_data)
114
  );
115
  sp_sram #(.DW(`IC_TAGRAM_SZ), .IW(`IC_SI_SZ)) t0 (
116
    .clk(clk),
117
    .addr(ic_tagram_addr),
118
    .wren(ic_tagram_wren),
119
    .din(ic_tagram_wr_data),
120
    .dout(ic_tagram_data)
121
  );
122
  `else
123
  assign ic_dataram_data = {`IC_LINE_SZ{1'b0}};
124
  assign ic_tagram_data  = {`IC_TAGRAM_SZ{1'b0}};
125
  `endif
126
 
127
endmodule

powered by: WebSVN 2.1.0

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