x393  1.0
FPGAcodeforElphelNC393camera
ram_1kx32w_512x64r.v
Go to the documentation of this file.
1 
25 /*
26  Address/data widths
27  Connect unused data to 1b0, unused addresses - to 1'b1
28 
29  RAMB18E1 in True Dual Port (TDP) Mode - each port individually
30  +-----------+---------+---------+---------+
31  |Data Width | Address | Data | Parity |
32  +-----------+---------+---------+---------+
33  | 1 | A[13:0] | D[0] | --- |
34  | 2 | A[13:1] | D[1:0] | --- |
35  | 4 | A[13:2] | D[3:0[ | --- |
36  | 9 | A[13:3] | D[7:0] | DP[0] |
37  | 18 | A[13:4] | D[15:0] | DP[1:0] |
38  +-----------+---------+---------+---------+
39 
40  RAMB18E1 in Simple Dual Port (SDP) Mode
41  one of the ports (r or w) - 32/36 bits, other - variable
42  +------------+---------+---------+---------+
43  |Data Widths | Address | Data | Parity |
44  +------------+---------+---------+---------+
45  | 32/ 1 | A[13:0] | D[0] | --- |
46  | 32/ 2 | A[13:1] | D[1:0] | --- |
47  | 32/ 4 | A[13:2] | D[3:0[ | --- |
48  | 36/ 9 | A[13:3] | D[7:0] | DP[0] |
49  | 36/ 18 | A[13:4] | D[15:0] | DP[1:0] |
50  | 36/ 36 | A[13:5] | D[31:0] | DP[3:0] |
51  +------------+---------+---------+---------+
52 
53  RAMB36E1 in True Dual Port (TDP) Mode - each port individually
54  +-----------+---------+---------+---------+
55  |Data Width | Address | Data | Parity |
56  +-----------+---------+---------+---------+
57  | 1 | A[14:0] | D[0] | --- |
58  | 2 | A[14:1] | D[1:0] | --- |
59  | 4 | A[14:2] | D[3:0[ | --- |
60  | 9 | A[14:3] | D[7:0] | DP[0] |
61  | 18 | A[14:4] | D[15:0] | DP[1:0] |
62  | 36 | A[14:5] | D[31:0] | DP[3:0] |
63  |1(Cascade) | A[15:0] | D[0] | --- |
64  +-----------+---------+---------+---------+
65 
66  RAMB36E1 in Simple Dual Port (SDP) Mode
67  one of the ports (r or w) - 64/72 bits, other - variable
68  +------------+---------+---------+---------+
69  |Data Widths | Address | Data | Parity |
70  +------------+---------+---------+---------+
71  | 64/ 1 | A[14:0] | D[0] | --- |
72  | 64/ 2 | A[14:1] | D[1:0] | --- |
73  | 64/ 4 | A[14:2] | D[3:0[ | --- |
74  | 64/ 9 | A[14:3] | D[7:0] | DP[0] |
75  | 64/ 18 | A[14:4] | D[15:0] | DP[1:0] |
76  | 64/ 36 | A[14:5] | D[31:0] | DP[3:0] |
77  | 64/ 72 | A[14:6] | D[63:0] | DP[7:0] |
78  +------------+---------+---------+---------+
79 */
81 #(
82  parameter integer REGISTERS = 0 // 1 - registered output
83  )
84  (
85  input rclk, // clock for read port
86  input [ 8:0] raddr, // read address
87  input ren, // read port enable
88  input regen, // output register enable
89  output [63:0] data_out, // data out
90 
91  input wclk, // clock for read port
92  input [ 9:0] waddr, // write address
93  input we, // write port enable
94  input [ 3:0] web, // write byte enable
95  input [31:0] data_in // data out
96  );
98  #(
99  .RSTREG_PRIORITY_A("RSTREG"), // Valid: "RSTREG" or "REGCE"
100  .RSTREG_PRIORITY_B("RSTREG"), // Valid: "RSTREG" or "REGCE"
101  .DOA_REG(REGISTERS), // Valid: 0 (no output registers) and 1 - one output register (in SDP - to lower 36)
102  .DOB_REG(REGISTERS), // Valid: 0 (no output registers) and 1 - one output register (in SDP - to lower 36)
103  .RAM_EXTENSION_A("NONE"), // Cascading, valid: "NONE","UPPER", LOWER"
104  .RAM_EXTENSION_B("NONE"), // Cascading, valid: "NONE","UPPER", LOWER"
105  .READ_WIDTH_A(72), // Valid: 0,1,2,4,9,18,36 and in SDP mode - 72 (should be 0 if port is not used)
106  .READ_WIDTH_B(0), // Valid: 0,1,2,4,9,18,36 and in SDP mode - 72 (should be 0 if port is not used)
107  .WRITE_WIDTH_A(0), // Valid: 0,1,2,4,9,18,36 and in SDP mode - 72 (should be 0 if port is not used)
108  .WRITE_WIDTH_B(36), // Valid: 0,1,2,4,9,18,36 and in SDP mode - 72 (should be 0 if port is not used)
109  .RAM_MODE("SDP"), // Valid "TDP" (true dual-port) and "SDP" - simple dual-port
110  .WRITE_MODE_A("WRITE_FIRST"), // Valid: "WRITE_FIRST", "READ_FIRST", "NO_CHANGE"
111  .WRITE_MODE_B("WRITE_FIRST"), // Valid: "WRITE_FIRST", "READ_FIRST", "NO_CHANGE"
112  .RDADDR_COLLISION_HWCONFIG("DELAYED_WRITE"),// Valid: "DELAYED_WRITE","PERFORMANCE" (no access to the same page)
113  .SIM_COLLISION_CHECK("ALL"), // Valid: "ALL", "GENERATE_X_ONLY", "NONE", and "WARNING_ONLY"
114  .INIT_FILE("NONE"), // "NONE" or filename with initialization data
115  .SIM_DEVICE("7SERIES"), // Simulation device family - "VIRTEX6", "VIRTEX5" and "7_SERIES" // "7SERIES"
116 
117  .EN_ECC_READ("FALSE"), // Valid:"FALSE","TRUE" (ECC decoder circuitry)
118  .EN_ECC_WRITE("FALSE") // Valid:"FALSE","TRUE" (ECC decoder circuitry)
119 // .INIT_A(36'h0), // Output latches initialization data
120 // .INIT_B(36'h0), // Output latches initialization data
121 // .SRVAL_A(36'h0), // Output latches initialization data (copied at when RSTRAM/RSTREG activated)
122 // .SRVAL_B(36'h0) // Output latches initialization data (copied at when RSTRAM/RSTREG activated)
123 /*
124  parameter IS_CLKARDCLK_INVERTED = 1'b0;
125  parameter IS_CLKBWRCLK_INVERTED = 1'b0;
126  parameter IS_ENARDEN_INVERTED = 1'b0;
127  parameter IS_ENBWREN_INVERTED = 1'b0;
128  parameter IS_RSTRAMARSTRAM_INVERTED = 1'b0;
129  parameter IS_RSTRAMB_INVERTED = 1'b0;
130  parameter IS_RSTREGARSTREG_INVERTED = 1'b0;
131  parameter IS_RSTREGB_INVERTED = 1'b0;
132 */
133 
134  ) RAMB36E1_i
135  (
136  // Port A (Read port in SDP mode):
137  .DOADO(data_out[31:0]), // Port A data/LSB data[63:0], output
138  .DOPADOP(), // Port A parity/LSB parity[7:0], output
139  .DIADI(32'h0), // Port A data/LSB data[31:0], input
140  .DIPADIP(4'h0), // Port A parity/LSB parity[3:0], input
141  .ADDRARDADDR({1'b1,raddr[8:0],6'b111111}), // Port A (read port in SDP) address [15:0]. used from [14] down, unused should be high, input
142  .CLKARDCLK(rclk), // Port A (read port in SDP) clock, input
143  .ENARDEN(ren), // Port A (read port in SDP) Enable, input
144  .REGCEAREGCE(regen), // Port A (read port in SDP) register enable, input
145  .RSTRAMARSTRAM(1'b0), // Port A (read port in SDP) set/reset, input
146  .RSTREGARSTREG(1'b0), // Port A (read port in SDP) register set/reset, input
147  .WEA(4'b0), // Port A (read port in SDP) Write Enable[3:0], input
148  // Port B
149  .DOBDO(data_out[63:32]), // Port B data/MSB data[31:0], output
150  .DOPBDOP(), // Port B parity/MSB parity[3:0], output
151  .DIBDI(data_in[31:0]), // Port B data/MSB data[31:0], input
152  .DIPBDIP(4'b0), // Port B parity/MSB parity[3:0], input
153  .ADDRBWRADDR({1'b1,waddr[9:0],5'b11111}), // Port B (write port in SDP) address [15:0]. used from [14] down, unused should be high, input
154  .CLKBWRCLK(wclk), // Port B (write port in SDP) clock, input
155  .ENBWREN(we), // Port B (write port in SDP) Enable, input
156  .REGCEB(1'b0), // Port B (write port in SDP) register enable, input
157  .RSTRAMB(1'b0), // Port B (write port in SDP) set/reset, input
158  .RSTREGB(1'b0), // Port B (write port in SDP) register set/reset, input
159  .WEBWE({4'b0,web[3:0]}), // Port B (write port in SDP) Write Enable[7:0], input
160  // Error correction circuitry
161  .SBITERR(), // Single bit error status, output
162  .DBITERR(), // Double bit error status, output
163  .ECCPARITY(), // Genearted error correction parity [7:0], output
164  .RDADDRECC(), // ECC read address[8:0], output
165  .INJECTSBITERR(1'b0),// inject a single-bit error, input
166  .INJECTDBITERR(1'b0),// inject a double-bit error, input
167  // Cascade signals to create 64Kx1
168  .CASCADEOUTA(), // A-port cascade, output
169  .CASCADEOUTB(), // B-port cascade, output
170  .CASCADEINA(1'b0), // A-port cascade, input
171  .CASCADEINB(1'b0) // B-port cascade, input
172  );
173 
174 endmodule
175