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 114

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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