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

Subversion Repositories cachecontroller

[/] [cachecontroller/] [trunk/] [rtl/] [verilog/] [memory_bank.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 chinthakaa
`timescale 1ns / 1ps
2
`include "C:/cachedesign/v1/ise/src/global_params.vh"
3
`include "C:/cachedesign/v1/ise/src/memory_params.vh"
4
//////////////////////////////////////////////////////////////////////////////////
5
// Company: 
6
// Engineer: Chinthaka A.K.
7
// 
8
// Create Date:    06:41:43 12/08/2009 
9
// Design Name: 
10
// Module Name:    memory_bank 
11
// Project Name: 
12
// Target Devices: 
13
// Tool versions: 
14
// Description: 
15
//
16
// Dependencies: 
17
//
18
// Revision: 
19
// Revision 0.01 - File Created
20
// Additional Comments: 
21
//
22
//////////////////////////////////////////////////////////////////////////////////
23
module memory_bank(CLK,EN,WE,SELECT,ADDR,DI,DO_BUF);
24
        input CLK,EN,WE;
25
        input [`OFFSET-1:0]SELECT;
26
        input [`ADDR_PORT_SIZE-1:0]ADDR;
27
        input [`DATA_PORT_SIZE-1:0] DI;
28
        output [`DATA_PORT_SIZE-1:0]DO_BUF;
29
 
30
        wire [`DATA_PORT_SIZE-1:0] DO;
31
        wire [`DATA_PORT_SIZE-1:0]DO0,DO1,DO2,DO3,DO4,DO5,DO6,DO7;
32
        wire [`DATA_PORT_SIZE-1:0]DI0,DI1,DI2,DI3,DI4,DI5,DI6,DI7;
33
 
34
        reg [`DATA_PORT_SIZE-1:0]REG_EN;
35
 
36
        bufif0_8bit bufout(DO_BUF,DO,WE);       // output buffer
37
 
38
        eight_to_one_mux_8bit mux(DO,{DO7,DO6,DO5,DO4,DO3,DO2,DO1,DO0},SELECT); // output mux
39
 
40
        initial REG_EN = 8'h00; // disable all banks for safe operation
41
 
42
        // Read burst and write normal
43
        always @(posedge CLK)
44
        begin
45
                REG_EN = 8'h00; // disable all banks
46
                if (EN)
47
                        begin
48
                                if (WE)
49
                                        begin
50
                                                REG_EN = 8'h00; // disable all banks
51
 
52
                                                case (ADDR[2:0]) // enable required single bank for normal write
53
                                                        3'h0 : REG_EN = 8'h01;
54
                                                        3'h1 : REG_EN = 8'h02;
55
                                                        3'h2 : REG_EN = 8'h04;
56
                                                        3'h3 : REG_EN = 8'h08;
57
                                                        3'h4 : REG_EN = 8'h10;
58
                                                        3'h5 : REG_EN = 8'h20;
59
                                                        3'h6 : REG_EN = 8'h40;
60
                                                        3'h7 : REG_EN = 8'h80;
61
                                                endcase
62
 
63
                                        end
64
                                else
65
                                        begin
66
                                                REG_EN = 8'hFF; // enable all banks for burst read
67
 
68
                                        end
69
                        end
70
                end
71
 
72
        // memory banks
73
        RAMB16_S8 bank0(CLK,REG_EN[0],WE,ADDR[13:3],DI0,DO0);
74
        RAMB16_S8 bank1(CLK,REG_EN[1],WE,ADDR[13:3],DI1,DO1);
75
        RAMB16_S8 bank2(CLK,REG_EN[2],WE,ADDR[13:3],DI2,DO2);
76
        RAMB16_S8 bank3(CLK,REG_EN[3],WE,ADDR[13:3],DI3,DO3);
77
        RAMB16_S8 bank4(CLK,REG_EN[4],WE,ADDR[13:3],DI4,DO4);
78
        RAMB16_S8 bank5(CLK,REG_EN[5],WE,ADDR[13:3],DI5,DO5);
79
        RAMB16_S8 bank6(CLK,REG_EN[6],WE,ADDR[13:3],DI6,DO6);
80
        RAMB16_S8 bank7(CLK,REG_EN[7],WE,ADDR[13:3],DI7,DO7);
81
 
82
        one_to_eight_demux_8bit demux({DI0,DI1,DI2,DI3,DI4,DI5,DI6,DI7},DI,ADDR[2:0]); // input mux
83
endmodule

powered by: WebSVN 2.1.0

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