1 module GP_2LUT(input IN0, IN1, output OUT);
2 parameter [3:0] INIT = 0;
3 assign OUT = INIT[{IN1, IN0}];
6 module GP_3LUT(input IN0, IN1, IN2, output OUT);
7 parameter [7:0] INIT = 0;
8 assign OUT = INIT[{IN2, IN1, IN0}];
11 module GP_4LUT(input IN0, IN1, IN2, IN3, output OUT);
12 parameter [15:0] INIT = 0;
13 assign OUT = INIT[{IN3, IN2, IN1, IN0}];
16 module GP_ABUF(input wire IN, output wire OUT);
22 module GP_ACMP(input wire PWREN, input wire VIN, input wire VREF, output reg OUT);
24 parameter BANDWIDTH = "HIGH";
25 parameter VIN_ATTEN = 1;
26 parameter VIN_ISRC_EN = 0;
27 parameter HYSTERESIS = 0;
31 //cannot simulate mixed signal IP
35 module GP_BANDGAP(output reg OK, output reg VOUT);
36 parameter AUTO_PWRDN = 1;
37 parameter CHOPPER_EN = 1;
38 parameter OUT_DELAY = 100;
40 //cannot simulate mixed signal IP
44 module GP_COUNT8(input CLK, input wire RST, output reg OUT);
46 parameter RESET_MODE = "RISING";
48 parameter COUNT_TO = 8'h1;
49 parameter CLKIN_DIVIDE = 1;
51 //more complex hard IP blocks are not supported for simulation yet
53 reg[7:0] count = COUNT_TO;
55 //Combinatorially output whenever we wrap low
57 OUT <= (count == 8'h0);
60 //POR or SYSRST reset value is COUNT_TO. Datasheet is unclear but conversations w/ Silego confirm.
61 //Runtime reset value is clearly 0 except in count/FSM cells where it's configurable but we leave at 0 for now.
62 //Datasheet seems to indicate that reset is asynchronous, but for now we model as sync due to Yosys issues...
63 always @(posedge CLK) begin
65 count <= count - 1'd1;
71 if((RESET_MODE == "RISING") && RST)
73 if((RESET_MODE == "FALLING") && !RST)
75 if((RESET_MODE == "BOTH") && RST)
82 module GP_COUNT14(input CLK, input wire RST, output reg OUT);
84 parameter RESET_MODE = "RISING";
86 parameter COUNT_TO = 14'h1;
87 parameter CLKIN_DIVIDE = 1;
89 //more complex hard IP blocks are not supported for simulation yet
93 module GP_DFF(input D, CLK, output reg Q);
94 parameter [0:0] INIT = 1'bx;
96 always @(posedge CLK) begin
101 module GP_DFFR(input D, CLK, nRST, output reg Q);
102 parameter [0:0] INIT = 1'bx;
104 always @(posedge CLK, negedge nRST) begin
112 module GP_DFFS(input D, CLK, nSET, output reg Q);
113 parameter [0:0] INIT = 1'bx;
115 always @(posedge CLK, negedge nSET) begin
123 module GP_DFFSR(input D, CLK, nSR, output reg Q);
124 parameter [0:0] INIT = 1'bx;
125 parameter [0:0] SRMODE = 1'bx;
127 always @(posedge CLK, negedge nSR) begin
135 module GP_INV(input IN, output OUT);
139 module GP_LFOSC(input PWRDN, output reg CLKOUT);
141 parameter PWRDN_EN = 0;
142 parameter AUTO_PWRDN = 0;
143 parameter OUT_DIV = 1;
147 //auto powerdown not implemented for simulation
148 //output dividers not implemented for simulation
154 //half period of 1730 Hz
162 module GP_PGA(input wire VIN_P, input wire VIN_N, input wire VIN_SEL, output reg VOUT);
165 parameter INPUT_MODE = "SINGLE";
169 //cannot simulate mixed signal IP
173 module GP_POR(output reg RST_DONE);
174 parameter POR_TIME = 500;
181 else if(POR_TIME == 500)
184 $display("ERROR: bad POR_TIME for GP_POR cell");
194 module GP_RCOSC(input PWRDN, output reg CLKOUT_PREDIV, output reg CLKOUT_FABRIC);
196 parameter PWRDN_EN = 0;
197 parameter AUTO_PWRDN = 0;
198 parameter PRE_DIV = 1;
199 parameter FABRIC_DIV = 1;
200 parameter OSC_FREQ = "25k";
202 initial CLKOUT_PREDIV = 0;
203 initial CLKOUT_FABRIC = 0;
205 //output dividers not implemented for simulation
206 //auto powerdown not implemented for simulation
215 if(OSC_FREQ == "25k") begin
216 //half period of 25 kHz
221 //half period of 2 MHz
225 CLKOUT_PREDIV = ~CLKOUT_PREDIV;
226 CLKOUT_FABRIC = ~CLKOUT_FABRIC;
232 module GP_RINGOSC(input PWRDN, output reg CLKOUT_PREDIV, output reg CLKOUT_FABRIC);
234 parameter PWRDN_EN = 0;
235 parameter AUTO_PWRDN = 0;
236 parameter PRE_DIV = 1;
237 parameter FABRIC_DIV = 1;
239 initial CLKOUT_PREDIV = 0;
240 initial CLKOUT_FABRIC = 0;
242 //output dividers not implemented for simulation
243 //auto powerdown not implemented for simulation
251 //half period of 27 MHz
253 CLKOUT_PREDIV = ~CLKOUT_PREDIV;
254 CLKOUT_FABRIC = ~CLKOUT_FABRIC;
260 module GP_SHREG(input nRST, input CLK, input IN, output OUTA, output OUTB);
262 parameter OUTA_DELAY = 1;
263 parameter OUTA_INVERT = 0;
264 parameter OUTB_DELAY = 1;
268 always @(posedge clk, negedge nRST) begin
274 shreg <= {shreg[14:0], IN};
278 assign OUTA = (OUTA_INVERT) ? ~shreg[OUTA_DELAY - 1] : shreg[OUTA_DELAY - 1];
279 assign OUTB = shreg[OUTB_DELAY - 1];
283 //keep constraint needed to prevent optimization since we have no outputs
285 module GP_SYSRESET(input RST);
286 parameter RESET_MODE = "RISING";
288 //cannot simulate whole system reset
292 module GP_VDD(output OUT);
296 module GP_VREF(input VIN, output reg VOUT);
297 parameter VIN_DIV = 1;
299 //cannot simulate mixed signal IP
302 module GP_VSS(output OUT);