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-3.1/] [rtl/] [verilog/] [mor1kx_true_dpram_sclk.v] - Blame information for rev 42

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 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 single clock
8
 
9
 Copyright (C) 2013 Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
10
 
11
 ******************************************************************************/
12 42 alirezamon
`timescale       1ns/1ps
13 38 alirezamon
module mor1kx_true_dpram_sclk
14
  #(
15
    parameter ADDR_WIDTH = 32,
16
    parameter DATA_WIDTH = 32
17
    )
18
   (
19
    input                   clk,
20
    input [ADDR_WIDTH-1:0]  addr_a,
21
    input                   we_a,
22
    input [DATA_WIDTH-1:0]  din_a,
23
    output [DATA_WIDTH-1:0] dout_a,
24
    input [ADDR_WIDTH-1:0]  addr_b,
25
    input                   we_b,
26
    input [DATA_WIDTH-1:0]  din_b,
27
    output [DATA_WIDTH-1:0] dout_b
28
    );
29
 
30
   reg [DATA_WIDTH-1:0]     mem[(1<<ADDR_WIDTH)-1:0];
31
 
32
   reg [DATA_WIDTH-1:0]     rdata_a;
33
   reg [DATA_WIDTH-1:0]     rdata_b;
34
 
35
   assign dout_a = rdata_a;
36
   assign dout_b = rdata_b;
37
 
38
   always @(posedge clk) begin
39
      if (we_a) begin
40
         mem[addr_a] <= din_a;
41
         rdata_a <= din_a;
42
      end else begin
43
         rdata_a <= mem[addr_a];
44
      end
45
   end
46
 
47
   always @(posedge clk) begin
48
      if (we_b) begin
49
         mem[addr_b] <= din_b;
50
         rdata_b <= din_b;
51
      end else begin
52
         rdata_b <= mem[addr_b];
53
      end
54
   end
55
 
56
endmodule

powered by: WebSVN 2.1.0

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