OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_processor/] [mor1kx-5.0/] [rtl/] [verilog/] [mor1kx_true_dpram_sclk.v] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
/******************************************************************************
2
 This Source Code Form is subject to the terms of the
3
 Open Hardware Description License, v. 1.0. If a copy
4
 of the OHDL was not distributed with this file, You
5
 can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt
6
 
7
 Description: True dual port ram with dual clock's
8
 
9
 Copyright (C) 2013 Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
10
 
11
 ******************************************************************************/
12
 
13
module mor1kx_true_dpram_sclk
14
  #(
15
    parameter ADDR_WIDTH = 32,
16
    parameter DATA_WIDTH = 32
17
    )
18
   (
19
    /* Port A */
20
    input                   clk_a,
21
    input [ADDR_WIDTH-1:0]  addr_a,
22
    input                   we_a,
23
    input [DATA_WIDTH-1:0]  din_a,
24
    output [DATA_WIDTH-1:0] dout_a,
25
 
26
    /* Port B */
27
    input                   clk_b,
28
    input [ADDR_WIDTH-1:0]  addr_b,
29
    input                   we_b,
30
    input [DATA_WIDTH-1:0]  din_b,
31
    output [DATA_WIDTH-1:0] dout_b
32
    );
33
 
34
   reg [DATA_WIDTH-1:0]     mem[(1<<ADDR_WIDTH)-1:0];
35
 
36
   reg [DATA_WIDTH-1:0]     rdata_a;
37
   reg [DATA_WIDTH-1:0]     rdata_b;
38
 
39
   assign dout_a = rdata_a;
40
   assign dout_b = rdata_b;
41
 
42
   always @(posedge clk_a) begin
43
      if (we_a) begin
44
         mem[addr_a] <= din_a;
45
         rdata_a <= din_a;
46
      end else begin
47
         rdata_a <= mem[addr_a];
48
      end
49
   end
50
 
51
   always @(posedge clk_b) begin
52
      if (we_b) begin
53
         mem[addr_b] <= din_b;
54
         rdata_b <= din_b;
55
      end else begin
56
         rdata_b <= mem[addr_b];
57
      end
58
   end
59
 
60
endmodule

powered by: WebSVN 2.1.0

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