3 module GP_2LUT(input IN0, IN1, output OUT);
4 parameter [3:0] INIT = 0;
5 assign OUT = INIT[{IN1, IN0}];
8 module GP_3LUT(input IN0, IN1, IN2, output OUT);
9 parameter [7:0] INIT = 0;
10 assign OUT = INIT[{IN2, IN1, IN0}];
13 module GP_4LUT(input IN0, IN1, IN2, IN3, output OUT);
14 parameter [15:0] INIT = 0;
15 assign OUT = INIT[{IN3, IN2, IN1, IN0}];
18 module GP_ABUF(input wire IN, output wire OUT);
22 //cannot simulate mixed signal IP
26 module GP_ACMP(input wire PWREN, input wire VIN, input wire VREF, output reg OUT);
28 parameter BANDWIDTH = "HIGH";
29 parameter VIN_ATTEN = 1;
30 parameter VIN_ISRC_EN = 0;
31 parameter HYSTERESIS = 0;
35 //cannot simulate mixed signal IP
39 module GP_BANDGAP(output reg OK);
40 parameter AUTO_PWRDN = 1;
41 parameter CHOPPER_EN = 1;
42 parameter OUT_DELAY = 100;
44 //cannot simulate mixed signal IP
48 module GP_COUNT8(input CLK, input wire RST, output reg OUT);
50 parameter RESET_MODE = "RISING";
52 parameter COUNT_TO = 8'h1;
53 parameter CLKIN_DIVIDE = 1;
55 //more complex hard IP blocks are not supported for simulation yet
57 reg[7:0] count = COUNT_TO;
59 //Combinatorially output whenever we wrap low
61 OUT <= (count == 8'h0);
64 //POR or SYSRST reset value is COUNT_TO. Datasheet is unclear but conversations w/ Silego confirm.
65 //Runtime reset value is clearly 0 except in count/FSM cells where it's configurable but we leave at 0 for now.
66 //Datasheet seems to indicate that reset is asynchronous, but for now we model as sync due to Yosys issues...
67 always @(posedge CLK) begin
69 count <= count - 1'd1;
75 if((RESET_MODE == "RISING") && RST)
77 if((RESET_MODE == "FALLING") && !RST)
79 if((RESET_MODE == "BOTH") && RST)
86 module GP_COUNT14(input CLK, input wire RST, output reg OUT);
88 parameter RESET_MODE = "RISING";
90 parameter COUNT_TO = 14'h1;
91 parameter CLKIN_DIVIDE = 1;
93 //more complex hard IP blocks are not supported for simulation yet
97 module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
98 input UP, input KEEP);
100 parameter RESET_MODE = "RISING";
101 parameter RESET_VALUE = "ZERO";
103 parameter COUNT_TO = 8'h1;
104 parameter CLKIN_DIVIDE = 1;
106 //more complex hard IP blocks are not supported for simulation yet
110 module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
111 input UP, input KEEP);
113 parameter RESET_MODE = "RISING";
114 parameter RESET_VALUE = "ZERO";
116 parameter COUNT_TO = 14'h1;
117 parameter CLKIN_DIVIDE = 1;
119 //more complex hard IP blocks are not supported for simulation yet
123 module GP_DAC(input[7:0] DIN, input wire VREF, output reg VOUT);
127 //analog hard IP is not supported for simulation
131 module GP_DELAY(input IN, output reg OUT);
133 parameter DELAY_STEPS = 1;
135 //TODO: additional delay/glitch filter mode
141 //TODO: These delays are PTV dependent! For now, hard code 3v3 timing
142 //Change simulation-mode delay depending on global Vdd range (how to specify this?)
150 $display("ERROR: GP_DELAY must have DELAY_STEPS in range [1,4]");
160 module GP_DFF(input D, CLK, output reg Q);
161 parameter [0:0] INIT = 1'bx;
163 always @(posedge CLK) begin
168 module GP_DFFI(input D, CLK, output reg nQ);
169 parameter [0:0] INIT = 1'bx;
171 always @(posedge CLK) begin
176 module GP_DFFR(input D, CLK, nRST, output reg Q);
177 parameter [0:0] INIT = 1'bx;
179 always @(posedge CLK, negedge nRST) begin
187 module GP_DFFRI(input D, CLK, nRST, output reg nQ);
188 parameter [0:0] INIT = 1'bx;
190 always @(posedge CLK, negedge nRST) begin
198 module GP_DFFS(input D, CLK, nSET, output reg Q);
199 parameter [0:0] INIT = 1'bx;
201 always @(posedge CLK, negedge nSET) begin
209 module GP_DFFSI(input D, CLK, nSET, output reg nQ);
210 parameter [0:0] INIT = 1'bx;
212 always @(posedge CLK, negedge nSET) begin
220 module GP_DFFSR(input D, CLK, nSR, output reg Q);
221 parameter [0:0] INIT = 1'bx;
222 parameter [0:0] SRMODE = 1'bx;
224 always @(posedge CLK, negedge nSR) begin
232 module GP_DFFSRI(input D, CLK, nSR, output reg nQ);
233 parameter [0:0] INIT = 1'bx;
234 parameter [0:0] SRMODE = 1'bx;
236 always @(posedge CLK, negedge nSR) begin
244 module GP_IBUF(input IN, output OUT);
248 module GP_IOBUF(input IN, input OE, output OUT, inout IO);
250 assign IO = OE ? IN : 1'bz;
253 module GP_INV(input IN, output OUT);
257 module GP_LFOSC(input PWRDN, output reg CLKOUT);
259 parameter PWRDN_EN = 0;
260 parameter AUTO_PWRDN = 0;
261 parameter OUT_DIV = 1;
265 //auto powerdown not implemented for simulation
266 //output dividers not implemented for simulation
272 //half period of 1730 Hz
280 module GP_OBUF(input IN, output OUT);
284 module GP_OBUFT(input IN, input OE, output OUT);
285 assign OUT = OE ? IN : 1'bz;
288 module GP_PGA(input wire VIN_P, input wire VIN_N, input wire VIN_SEL, output reg VOUT);
291 parameter INPUT_MODE = "SINGLE";
295 //cannot simulate mixed signal IP
299 module GP_POR(output reg RST_DONE);
300 parameter POR_TIME = 500;
307 else if(POR_TIME == 500)
310 $display("ERROR: bad POR_TIME for GP_POR cell");
320 module GP_RCOSC(input PWRDN, output reg CLKOUT_HARDIP, output reg CLKOUT_FABRIC);
322 parameter PWRDN_EN = 0;
323 parameter AUTO_PWRDN = 0;
324 parameter HARDIP_DIV = 1;
325 parameter FABRIC_DIV = 1;
326 parameter OSC_FREQ = "25k";
328 initial CLKOUT_HARDIP = 0;
329 initial CLKOUT_FABRIC = 0;
331 //output dividers not implemented for simulation
332 //auto powerdown not implemented for simulation
341 if(OSC_FREQ == "25k") begin
342 //half period of 25 kHz
347 //half period of 2 MHz
351 CLKOUT_HARDIP = ~CLKOUT_HARDIP;
352 CLKOUT_FABRIC = ~CLKOUT_FABRIC;
358 module GP_RINGOSC(input PWRDN, output reg CLKOUT_HARDIP, output reg CLKOUT_FABRIC);
360 parameter PWRDN_EN = 0;
361 parameter AUTO_PWRDN = 0;
362 parameter HARDIP_DIV = 1;
363 parameter FABRIC_DIV = 1;
365 initial CLKOUT_HARDIP = 0;
366 initial CLKOUT_FABRIC = 0;
368 //output dividers not implemented for simulation
369 //auto powerdown not implemented for simulation
377 //half period of 27 MHz
379 CLKOUT_HARDIP = ~CLKOUT_HARDIP;
380 CLKOUT_FABRIC = ~CLKOUT_FABRIC;
386 module GP_SHREG(input nRST, input CLK, input IN, output OUTA, output OUTB);
388 parameter OUTA_TAP = 1;
389 parameter OUTA_INVERT = 0;
390 parameter OUTB_TAP = 1;
394 always @(posedge CLK, negedge nRST) begin
400 shreg <= {shreg[14:0], IN};
404 assign OUTA = (OUTA_INVERT) ? ~shreg[OUTA_TAP - 1] : shreg[OUTA_TAP - 1];
405 assign OUTB = shreg[OUTB_TAP - 1];
409 //keep constraint needed to prevent optimization since we have no outputs
411 module GP_SYSRESET(input RST);
412 parameter RESET_MODE = "RISING";
414 //cannot simulate whole system reset
418 module GP_VDD(output OUT);
422 module GP_VREF(input VIN, output reg VOUT);
423 parameter VIN_DIV = 1;
425 //cannot simulate mixed signal IP
428 module GP_VSS(output OUT);