1 module GP_DFF(input D, CLK, output reg Q);
2 parameter [0:0] INIT = 1'bx;
4 always @(posedge CLK) begin
9 module GP_DFFS(input D, CLK, nSET, output reg Q);
10 parameter [0:0] INIT = 1'bx;
12 always @(posedge CLK, negedge nSET) begin
20 module GP_DFFR(input D, CLK, nRST, output reg Q);
21 parameter [0:0] INIT = 1'bx;
23 always @(posedge CLK, negedge nRST) begin
31 module GP_DFFSR(input D, CLK, nSR, output reg Q);
32 parameter [0:0] INIT = 1'bx;
33 parameter [0:0] SRMODE = 1'bx;
35 always @(posedge CLK, negedge nSR) begin
43 module GP_INV(input IN, output OUT);
47 module GP_2LUT(input IN0, IN1, output OUT);
48 parameter [3:0] INIT = 0;
49 assign OUT = INIT[{IN1, IN0}];
52 module GP_3LUT(input IN0, IN1, IN2, output OUT);
53 parameter [7:0] INIT = 0;
54 assign OUT = INIT[{IN2, IN1, IN0}];
57 module GP_4LUT(input IN0, IN1, IN2, IN3, output OUT);
58 parameter [15:0] INIT = 0;
59 assign OUT = INIT[{IN3, IN2, IN1, IN0}];
62 module GP_VDD(output OUT);
66 module GP_VSS(output OUT);
70 module GP_LFOSC(input PWRDN, output reg CLKOUT);
72 parameter PWRDN_EN = 0;
73 parameter AUTO_PWRDN = 0;
74 parameter OUT_DIV = 1;
82 //half period of 1730 Hz
90 module GP_COUNT8(input CLK, input wire RST, output reg OUT);
92 parameter RESET_MODE = "RISING";
94 parameter COUNT_TO = 8'h1;
95 parameter CLKIN_DIVIDE = 1;
97 //more complex hard IP blocks are not supported for simulation yet
99 reg[7:0] count = COUNT_TO;
101 //Combinatorially output whenever we wrap low
103 OUT <= (count == 8'h0);
106 //POR or SYSRST reset value is COUNT_TO. Datasheet is unclear but conversations w/ Silego confirm.
107 //Runtime reset value is clearly 0 except in count/FSM cells where it's configurable but we leave at 0 for now.
108 //Datasheet seems to indicate that reset is asynchronous, but for now we model as sync due to Yosys issues...
109 always @(posedge CLK) begin
111 count <= count - 1'd1;
117 if((RESET_MODE == "RISING") && RST)
119 if((RESET_MODE == "FALLING") && !RST)
121 if((RESET_MODE == "BOTH") && RST)
128 module GP_COUNT14(input CLK, input wire RST, output reg OUT);
130 parameter RESET_MODE = "RISING";
132 parameter COUNT_TO = 14'h1;
133 parameter CLKIN_DIVIDE = 1;
135 //more complex hard IP blocks are not supported for simulation yet
139 //keep constraint needed to prevent optimization since we have no outputs
141 module GP_SYSRESET(input RST);
142 parameter RESET_MODE = "RISING";
144 //cannot simulate whole system reset
148 module GP_BANDGAP(output reg OK, output reg VOUT);
149 parameter AUTO_PWRDN = 1;
150 parameter CHOPPER_EN = 1;
151 parameter OUT_DELAY = 100;
153 //cannot simulate mixed signal IP
158 module GP_POR(output reg RST_DONE);
159 parameter POR_TIME = 500;
166 else if(POR_TIME == 500)
169 $display("ERROR: bad POR_TIME for GP_POR cell");