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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [s1_top/] [cachedir.v] - Blame information for rev 113

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

Line No. Rev Author Line
1 113 albert.wat
/*
2
 * Simply RISC CacheDir
3
 *
4
 * (C) Copyleft 2007 Simply RISC LLP
5
 * AUTHOR: Fabrizio Fazzino <fabrizio.fazzino@srisc.com>
6
 *
7
 * LICENSE:
8
 * This is a Free Hardware Design; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * version 2 as published by the Free Software Foundation.
11
 * The above named program is distributed in the hope that it will
12
 * be useful, but WITHOUT ANY WARRANTY; without even the implied
13
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 * See the GNU General Public License for more details.
15
 *
16
 * DESCRIPTION:
17
 * Replica of the 'cachedir' module used by Dmitry for his advanced
18
 * bridge, the original one was from an Altera Memory Megafunction.
19
 */
20
 
21
`timescale 1ns/100ps
22
 
23
`define CACHEDIR_ADDR_WIDTH  9
24
`define CACHEDIR_DATA_WIDTH 29
25
 
26
module cachedir(
27
  // System
28
  input clock,
29
  input enable,
30
 
31
  // Port A
32
  input wren_a,
33
  input [(`CACHEDIR_ADDR_WIDTH-1):0] address_a,
34
  input [(`CACHEDIR_DATA_WIDTH-1):0] data_a,
35
  output [(`CACHEDIR_DATA_WIDTH-1):0] q_a,
36
 
37
  // Port B
38
  input wren_b,
39
  input [(`CACHEDIR_ADDR_WIDTH-1):0] address_b,
40
  input [(`CACHEDIR_DATA_WIDTH-1):0] data_b,
41
  output [(`CACHEDIR_DATA_WIDTH-1):0] q_b
42
);
43
 
44
  // Memory Array
45
  logic [(`CACHEDIR_DATA_WIDTH-1):0] mem[(1<<`CACHEDIR_ADDR_WIDTH)-1];
46
 
47
  // Read Logic (TODO: may be gate by enable to save power)
48
  assign q_a = mem[address_a];
49
  assign q_b = mem[address_b];
50
 
51
  // Write Process (TODO: may be gated by some reset)
52
  always @(posedge clock) begin
53
    if(wren_a) begin
54
`ifdef SIMPLY_RISC_DEBUG
55
      $display("CacheDir Write Enable Port A");
56
`endif
57
      mem[address_a] <= data_a;
58
    end
59
    if(wren_b) begin
60
`ifdef SIMPLY_RISC_DEBUG
61
      $display("CacheDir Write Enable Port B");
62
`endif
63
      mem[address_b] <= data_b;
64
    end
65
  end
66
 
67
endmodule // cachedir
68
 

powered by: WebSVN 2.1.0

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