3 `include "cells_sim_ams.v"
4 `include "cells_sim_digital.v"
6 //Cells still in this file have INCOMPLETE simulation models, need to finish them
8 module GP_DCMP(input[7:0] INP, input[7:0] INN, input CLK, input PWRDN, output reg GREATER, output reg EQUAL);
9 parameter PWRDN_SYNC = 1'b0;
10 parameter CLK_EDGE = "RISING";
11 parameter GREATER_OR_EQUAL = 1'b0;
13 //TODO implement power-down mode
18 wire clk_minv = (CLK_EDGE == "RISING") ? CLK : ~CLK;
19 always @(posedge clk_minv) begin
21 GREATER <= (INP >= INN);
23 GREATER <= (INP > INN);
25 EQUAL <= (INP == INN);
30 module GP_EDGEDET(input IN, output reg OUT);
32 parameter EDGE_DIRECTION = "RISING";
33 parameter DELAY_STEPS = 1;
34 parameter GLITCH_FILTER = 0;
36 //not implemented for simulation
40 module GP_RCOSC(input PWRDN, output reg CLKOUT_HARDIP, output reg CLKOUT_FABRIC);
42 parameter PWRDN_EN = 0;
43 parameter AUTO_PWRDN = 0;
44 parameter HARDIP_DIV = 1;
45 parameter FABRIC_DIV = 1;
46 parameter OSC_FREQ = "25k";
48 initial CLKOUT_HARDIP = 0;
49 initial CLKOUT_FABRIC = 0;
51 //output dividers not implemented for simulation
52 //auto powerdown not implemented for simulation
61 if(OSC_FREQ == "25k") begin
62 //half period of 25 kHz
67 //half period of 2 MHz
71 CLKOUT_HARDIP = ~CLKOUT_HARDIP;
72 CLKOUT_FABRIC = ~CLKOUT_FABRIC;
78 module GP_RINGOSC(input PWRDN, output reg CLKOUT_HARDIP, output reg CLKOUT_FABRIC);
80 parameter PWRDN_EN = 0;
81 parameter AUTO_PWRDN = 0;
82 parameter HARDIP_DIV = 1;
83 parameter FABRIC_DIV = 1;
85 initial CLKOUT_HARDIP = 0;
86 initial CLKOUT_FABRIC = 0;
88 //output dividers not implemented for simulation
89 //auto powerdown not implemented for simulation
97 //half period of 27 MHz
99 CLKOUT_HARDIP = ~CLKOUT_HARDIP;
100 CLKOUT_FABRIC = ~CLKOUT_FABRIC;
112 output reg[7:0] RXD_HIGH,
113 output reg[7:0] RXD_LOW,
116 initial RXD_HIGH = 0;
120 parameter DATA_WIDTH = 8; //byte or word width
121 parameter SPI_CPHA = 0; //SPI clock phase
122 parameter SPI_CPOL = 0; //SPI clock polarity
123 parameter DIRECTION = "INPUT"; //SPI data direction (either input to chip or output to host)
124 //parallel output to fabric not yet implemented
126 //TODO: write sim model
127 //TODO: SPI SDIO control... can we use ADC output while SPI is input??
132 //keep constraint needed to prevent optimization since we have no outputs
134 module GP_SYSRESET(input RST);
135 parameter RESET_MODE = "EDGE";
136 parameter EDGE_SPEED = 4;
138 //cannot simulate whole system reset