4 This file contains simulation models for GreenPAK cells which are possible to fully model using synthesizeable
5 behavioral Verilog constructs only.
8 module GP_2LUT(input IN0, IN1, output OUT);
9 parameter [3:0] INIT = 0;
10 assign OUT = INIT[{IN1, IN0}];
13 module GP_3LUT(input IN0, IN1, IN2, output OUT);
14 parameter [7:0] INIT = 0;
15 assign OUT = INIT[{IN2, IN1, IN0}];
18 module GP_4LUT(input IN0, IN1, IN2, IN3, output OUT);
19 parameter [15:0] INIT = 0;
20 assign OUT = INIT[{IN3, IN2, IN1, IN0}];
23 module GP_CLKBUF(input wire IN, output wire OUT);
27 module GP_DCMPREF(output reg[7:0]OUT);
28 parameter[7:0] REF_VAL = 8'h00;
29 initial OUT = REF_VAL;
32 module GP_DCMPMUX(input[1:0] SEL, input[7:0] IN0, input[7:0] IN1, input[7:0] IN2, input[7:0] IN3, output reg[7:0] OUTA, output reg[7:0] OUTB);
60 module GP_DELAY(input IN, output reg OUT);
62 parameter DELAY_STEPS = 1;
63 parameter GLITCH_FILTER = 0;
69 if(GLITCH_FILTER) begin
71 $display("ERROR: GP_DELAY glitch filter mode not implemented");
76 //TODO: These delays are PTV dependent! For now, hard code 3v3 timing
77 //Change simulation-mode delay depending on global Vdd range (how to specify this?)
85 $display("ERROR: GP_DELAY must have DELAY_STEPS in range [1,4]");
95 module GP_DFF(input D, CLK, output reg Q);
96 parameter [0:0] INIT = 1'bx;
98 always @(posedge CLK) begin
103 module GP_DFFI(input D, CLK, output reg nQ);
104 parameter [0:0] INIT = 1'bx;
106 always @(posedge CLK) begin
111 module GP_DFFR(input D, CLK, nRST, output reg Q);
112 parameter [0:0] INIT = 1'bx;
114 always @(posedge CLK, negedge nRST) begin
122 module GP_DFFRI(input D, CLK, nRST, output reg nQ);
123 parameter [0:0] INIT = 1'bx;
125 always @(posedge CLK, negedge nRST) begin
133 module GP_DFFS(input D, CLK, nSET, output reg Q);
134 parameter [0:0] INIT = 1'bx;
136 always @(posedge CLK, negedge nSET) begin
144 module GP_DFFSI(input D, CLK, nSET, output reg nQ);
145 parameter [0:0] INIT = 1'bx;
147 always @(posedge CLK, negedge nSET) begin
155 module GP_DFFSR(input D, CLK, nSR, output reg Q);
156 parameter [0:0] INIT = 1'bx;
157 parameter [0:0] SRMODE = 1'bx;
159 always @(posedge CLK, negedge nSR) begin
167 module GP_DFFSRI(input D, CLK, nSR, output reg nQ);
168 parameter [0:0] INIT = 1'bx;
169 parameter [0:0] SRMODE = 1'bx;
171 always @(posedge CLK, negedge nSR) begin
179 module GP_DLATCH(input D, input nCLK, output reg Q);
180 parameter [0:0] INIT = 1'bx;
188 module GP_DLATCHI(input D, input nCLK, output reg nQ);
189 parameter [0:0] INIT = 1'bx;
197 module GP_DLATCHR(input D, input nCLK, input nRST, output reg Q);
198 parameter [0:0] INIT = 1'bx;
208 module GP_DLATCHRI(input D, input nCLK, input nRST, output reg nQ);
209 parameter [0:0] INIT = 1'bx;
219 module GP_DLATCHS(input D, input nCLK, input nSET, output reg Q);
220 parameter [0:0] INIT = 1'bx;
230 module GP_DLATCHSI(input D, input nCLK, input nSET, output reg nQ);
231 parameter [0:0] INIT = 1'bx;
241 module GP_DLATCHSR(input D, input nCLK, input nSR, output reg Q);
242 parameter [0:0] INIT = 1'bx;
243 parameter[0:0] SRMODE = 1'bx;
253 module GP_DLATCHSRI(input D, input nCLK, input nSR, output reg nQ);
254 parameter [0:0] INIT = 1'bx;
255 parameter[0:0] SRMODE = 1'bx;
265 module GP_IBUF(input IN, output OUT);
269 module GP_IOBUF(input IN, input OE, output OUT, inout IO);
271 assign IO = OE ? IN : 1'bz;
274 module GP_INV(input IN, output OUT);
278 module GP_OBUF(input IN, output OUT);
282 module GP_OBUFT(input IN, input OE, output OUT);
283 assign OUT = OE ? IN : 1'bz;
286 module GP_PGEN(input wire nRST, input wire CLK, output reg OUT);
288 parameter PATTERN_DATA = 16'h0;
289 parameter PATTERN_LEN = 5'd16;
292 always @(posedge CLK) begin
294 OUT <= PATTERN_DATA[0];
298 OUT <= PATTERN_DATA[count];
300 if( (count + 1) == PATTERN_LEN)
307 module GP_POR(output reg RST_DONE);
308 parameter POR_TIME = 500;
315 else if(POR_TIME == 500)
318 $display("ERROR: bad POR_TIME for GP_POR cell");
328 module GP_SHREG(input nRST, input CLK, input IN, output OUTA, output OUTB);
330 parameter OUTA_TAP = 1;
331 parameter OUTA_INVERT = 0;
332 parameter OUTB_TAP = 1;
336 always @(posedge CLK, negedge nRST) begin
342 shreg <= {shreg[14:0], IN};
346 assign OUTA = (OUTA_INVERT) ? ~shreg[OUTA_TAP - 1] : shreg[OUTA_TAP - 1];
347 assign OUTB = shreg[OUTB_TAP - 1];
351 module GP_VDD(output OUT);
355 module GP_VSS(output OUT);