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

Subversion Repositories rtftextcontroller

[/] [rtftextcontroller/] [trunk/] [rtl/] [verilog/] [syncRam4kx9_1rw1r.v] - Blame information for rev 26

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

Line No. Rev Author Line
1 3 robfinch
/* ===============================================================
2
        2008,2011  Robert Finch
3
        robfinch@sympatico.ca
4
 
5
        syncRam4kx9_1rw1r.v
6
 
7
        This source code is free for use and modification for
8
        non-commercial or evaluation purposes, provided this
9
        copyright statement and disclaimer remains present in
10
        the file.
11
 
12
        If you do modify the code, please state the origin and
13
        note that you have modified the code.
14
 
15
        NO WARRANTY.
16
        THIS Work, IS PROVIDEDED "AS IS" WITH NO WARRANTIES OF
17
        ANY KIND, WHETHER EXPRESS OR IMPLIED. The user must assume
18
        the entire risk of using the Work.
19
 
20
        IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
21
        ANY INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES
22
        WHATSOEVER RELATING TO THE USE OF THIS WORK, OR YOUR
23
        RELATIONSHIP WITH THE AUTHOR.
24
 
25
        IN ADDITION, IN NO EVENT DOES THE AUTHOR AUTHORIZE YOU
26
        TO USE THE WORK IN APPLICATIONS OR SYSTEMS WHERE THE
27
        WORK'S FAILURE TO PERFORM CAN REASONABLY BE EXPECTED
28
        TO RESULT IN A SIGNIFICANT PHYSICAL INJURY, OR IN LOSS
29
        OF LIFE. ANY SUCH USE BY YOU IS ENTIRELY AT YOUR OWN RISK,
30
        AND YOU AGREE TO HOLD THE AUTHOR AND CONTRIBUTORS HARMLESS
31
        FROM ANY CLAIMS OR LOSSES RELATING TO SUCH UNAUTHORIZED
32
        USE.
33
 
34
 
35
=============================================================== */
36
 
37
`define SYNTHESIS
38
`define VENDOR_XILINX
39
`define SPARTAN3
40
 
41
module syncRam4kx9_1rw1r(
42
        input wrst,
43
        input wclk,
44
        input wce,
45
        input we,
46
        input [11:0] wadr,
47
        input [8:0] i,
48
        output [8:0] wo,
49
        input rrst,
50
        input rclk,
51
        input rce,
52
        input [11:0] radr,
53
        output [8:0] o
54
);
55
 
56
`ifdef SYNTHESIS
57
`ifdef VENDOR_XILINX
58
 
59
`ifdef SPARTAN3
60
        wire [8:0] o0;
61
        wire [8:0] o1;
62
        wire [8:0] wo0;
63
        wire [8:0] wo1;
64
        wire rrst0 =  radr[11];
65
        wire rrst1 = ~radr[11];
66
        wire wrst0 =  wadr[11];
67
        wire wrst1 = ~wadr[11];
68
        wire we0 = we & ~wadr[11];
69
        wire we1 = we &  wadr[11];
70
 
71
        RAMB16_S9_S9 ram0(
72
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[7:0]), .DIPA(i[8]), .DOA(wo0[7:0]), .DOPA(wo0[8]), .ENA(wce), .WEA(we0), .SSRA(wrst0),
73
                .CLKB(rclk), .ADDRB(radr), .DIB(8'hFF), .DIPB(1'b1), .DOB(o0[7:0]), .DOPB(o0[8]), .ENB(rce), .WEB(1'b0), .SSRB(rrst0)  );
74
        RAMB16_S9_S9 ram1(
75
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[7:0]), .DIPA(i[8]), .DOA(wo1[7:0]), .DOPA(wo1[8]), .ENA(wce), .WEA(we1), .SSRA(wrst1),
76
                .CLKB(rclk), .ADDRB(radr), .DIB(8'hFF), .DIPB(1'b1), .DOB(o1[7:0]), .DOPB(o1[8]), .ENB(rce), .WEB(1'b0), .SSRB(rrst1)  );
77
 
78
        assign o = o0|o1;
79
        assign wo = wo0|wo1;
80
 
81
`endif
82
 
83
`ifdef SPARTAN2
84
        RAMB4_S1_S1 ram0(
85
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[0]), .DOA(wo[0]), .ENA(wce), .WEA(we), .RSTA(wrst),
86
                .CLKB(rclk), .ADDRB(radr), .DIB(1'b1), .DOB(o[0]), .ENB(rce), .WEB(1'b0), .RSTB(rrst)  );
87
        RAMB4_S1_S1 ram1(
88
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[1]), .DOA(wo[1]), .ENA(wce), .WEA(we), .RSTA(wrst),
89
                .CLKB(rclk), .ADDRB(radr), .DIB(1'b1), .DOB(o[1]), .ENB(rce), .WEB(1'b0), .RSTB(rrst)  );
90
        RAMB4_S1_S1 ram2(
91
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[2]), .DOA(wo[2]), .ENA(wce), .WEA(we), .RSTA(wrst),
92
                .CLKB(rclk), .ADDRB(radr), .DIB(1'b1), .DOB(o[2]), .ENB(rce), .WEB(1'b0), .RSTB(rrst)  );
93
        RAMB4_S1_S1 ram3(
94
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[3]), .DOA(wo[3]), .ENA(wce), .WEA(we), .RSTA(wrst),
95
                .CLKB(rclk), .ADDRB(radr), .DIB(1'b1), .DOB(o[3]), .ENB(rce), .WEB(1'b0), .RSTB(rrst)  );
96
        RAMB4_S1_S1 ram4(
97
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[4]), .DOA(wo[4]), .ENA(wce), .WEA(we), .RSTA(wrst),
98
                .CLKB(rclk), .ADDRB(radr), .DIB(1'b1), .DOB(o[4]), .ENB(rce), .WEB(1'b0), .RSTB(rrst)  );
99
        RAMB4_S1_S1 ram5(
100
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[5]), .DOA(wo[5]), .ENA(wce), .WEA(we), .RSTA(wrst),
101
                .CLKB(rclk), .ADDRB(radr), .DIB(1'b1), .DOB(o[5]), .ENB(rce), .WEB(1'b0), .RSTB(rrst)  );
102
        RAMB4_S1_S1 ram6(
103
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[6]), .DOA(wo[6]), .ENA(wce), .WEA(we), .RSTA(wrst),
104
                .CLKB(rclk), .ADDRB(radr), .DIB(1'b1), .DOB(o[6]), .ENB(rce), .WEB(1'b0), .RSTB(rrst)  );
105
        RAMB4_S1_S1 ram7(
106
                .CLKA(wclk), .ADDRA(wadr), .DIA(i[7]), .DOA(wo[7]), .ENA(wce), .WEA(we), .RSTA(wrst),
107
                .CLKB(rclk), .ADDRB(radr), .DIB(1'b1), .DOB(o[7]), .ENB(rce), .WEB(1'b0), .RSTB(rrst)  );
108
`endif
109
 
110
`endif
111
 
112
`ifdef VENDOR_ALTERA
113
 
114
        reg [8:0] mem [4095:0];
115
        reg [10:0] rradr;
116
        reg [10:0] rwadr;
117
 
118
        // register read addresses
119
        always @(posedge rclk)
120
                if (rce) rradr <= radr;
121
 
122
        assign o = mem[rradr];
123
 
124
        // write side
125
        always @(posedge wclk)
126
                if (wce) rwadr <= wadr;
127
 
128
        always @(posedge wclk)
129
                if (wce) mem[wadr] <= i;
130
 
131
        assign wo = mem[rwadr];
132
 
133
`endif
134
 
135
`else
136
 
137
        reg [8:0] mem [4095:0];
138
        reg [10:0] rradr;
139
        reg [10:0] rwadr;
140
 
141
        // register read addresses
142
        always @(posedge rclk)
143
                if (rce) rradr <= radr;
144
 
145
        assign o = mem[rradr];
146
 
147
        // write side
148
        always @(posedge wclk)
149
                if (wce) rwadr <= wadr;
150
 
151
        always @(posedge wclk)
152
                if (wce) mem[wadr] <= i;
153
 
154
        assign wo = mem[rwadr];
155
 
156
`endif
157
 
158
endmodule

powered by: WebSVN 2.1.0

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