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_BANDGAP(output reg OK, output reg VOUT);
17 parameter AUTO_PWRDN = 1;
18 parameter CHOPPER_EN = 1;
19 parameter OUT_DELAY = 100;
21 //cannot simulate mixed signal IP
25 module GP_COUNT8(input CLK, input wire RST, output reg OUT);
27 parameter RESET_MODE = "RISING";
29 parameter COUNT_TO = 8'h1;
30 parameter CLKIN_DIVIDE = 1;
32 //more complex hard IP blocks are not supported for simulation yet
34 reg[7:0] count = COUNT_TO;
36 //Combinatorially output whenever we wrap low
38 OUT <= (count == 8'h0);
41 //POR or SYSRST reset value is COUNT_TO. Datasheet is unclear but conversations w/ Silego confirm.
42 //Runtime reset value is clearly 0 except in count/FSM cells where it's configurable but we leave at 0 for now.
43 //Datasheet seems to indicate that reset is asynchronous, but for now we model as sync due to Yosys issues...
44 always @(posedge CLK) begin
46 count <= count - 1'd1;
52 if((RESET_MODE == "RISING") && RST)
54 if((RESET_MODE == "FALLING") && !RST)
56 if((RESET_MODE == "BOTH") && RST)
63 module GP_COUNT14(input CLK, input wire RST, output reg OUT);
65 parameter RESET_MODE = "RISING";
67 parameter COUNT_TO = 14'h1;
68 parameter CLKIN_DIVIDE = 1;
70 //more complex hard IP blocks are not supported for simulation yet
74 module GP_DFF(input D, CLK, output reg Q);
75 parameter [0:0] INIT = 1'bx;
77 always @(posedge CLK) begin
82 module GP_DFFR(input D, CLK, nRST, output reg Q);
83 parameter [0:0] INIT = 1'bx;
85 always @(posedge CLK, negedge nRST) begin
93 module GP_DFFS(input D, CLK, nSET, output reg Q);
94 parameter [0:0] INIT = 1'bx;
96 always @(posedge CLK, negedge nSET) begin
104 module GP_DFFSR(input D, CLK, nSR, output reg Q);
105 parameter [0:0] INIT = 1'bx;
106 parameter [0:0] SRMODE = 1'bx;
108 always @(posedge CLK, negedge nSR) begin
116 module GP_INV(input IN, output OUT);
120 module GP_LFOSC(input PWRDN, output reg CLKOUT);
122 parameter PWRDN_EN = 0;
123 parameter AUTO_PWRDN = 0;
124 parameter OUT_DIV = 1;
128 //auto powerdown not implemented for simulation
129 //output dividers not implemented for simulation
135 //half period of 1730 Hz
143 module GP_POR(output reg RST_DONE);
144 parameter POR_TIME = 500;
151 else if(POR_TIME == 500)
154 $display("ERROR: bad POR_TIME for GP_POR cell");
164 module GP_RCOSC(input PWRDN, output reg CLKOUT_PREDIV, output reg CLKOUT_FABRIC);
166 parameter PWRDN_EN = 0;
167 parameter AUTO_PWRDN = 0;
168 parameter PRE_DIV = 1;
169 parameter FABRIC_DIV = 1;
170 parameter OSC_FREQ = "25k";
172 initial CLKOUT_PREDIV = 0;
173 initial CLKOUT_FABRIC = 0;
175 //output dividers not implemented for simulation
176 //auto powerdown not implemented for simulation
185 if(OSC_FREQ == "25k") begin
186 //half period of 25 kHz
191 //half period of 2 MHz
195 CLKOUT_PREDIV = ~CLKOUT_PREDIV;
196 CLKOUT_FABRIC = ~CLKOUT_FABRIC;
202 module GP_RINGOSC(input PWRDN, output reg CLKOUT_PREDIV, output reg CLKOUT_FABRIC);
204 parameter PWRDN_EN = 0;
205 parameter AUTO_PWRDN = 0;
206 parameter PRE_DIV = 1;
207 parameter FABRIC_DIV = 1;
209 initial CLKOUT_PREDIV = 0;
210 initial CLKOUT_FABRIC = 0;
212 //output dividers not implemented for simulation
213 //auto powerdown not implemented for simulation
221 //half period of 27 MHz
223 CLKOUT_PREDIV = ~CLKOUT_PREDIV;
224 CLKOUT_FABRIC = ~CLKOUT_FABRIC;
230 module GP_SHREG(input nRST, input CLK, input IN, output OUTA, output OUTB);
232 parameter OUTA_DELAY = 1;
233 parameter OUTA_INVERT = 0;
234 parameter OUTB_DELAY = 1;
238 always @(posedge clk, negedge RSTN) begin
244 shreg <= {shreg[14:0], IN};
248 assign OUTA = (OUTA_INVERT) ? ~shreg[OUTA_DELAY - 1] : shreg[OUTA_DELAY - 1];
249 assign OUTB = shreg[OUTB_DELAY - 1];
253 //keep constraint needed to prevent optimization since we have no outputs
255 module GP_SYSRESET(input RST);
256 parameter RESET_MODE = "RISING";
258 //cannot simulate whole system reset
262 module GP_VDD(output OUT);
266 module GP_VSS(output OUT);