Skip to content

Commit a4500d3

Browse files
authored
Merge pull request #128 from siliconcompiler/pll_fix
Cleaning up naming and adding a model to PLL wrapper
2 parents 839ed04 + 2bc409f commit a4500d3

File tree

1 file changed

+50
-28
lines changed

1 file changed

+50
-28
lines changed

lambdalib/analoglib/la_pll/rtl/la_pll.v

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,67 @@
33
* Copyright: Lambda Project Authors. All rights Reserved.
44
* License: MIT (see LICENSE file in Lambda repository)
55
*
6-
* NOTE: Interface was derived by reviewing a number of publicly
7-
* open source PLLs and FPGA IP datasheets.
6+
* NOTE: The generic interface was derived by reviewing a number of
7+
* publicly open source PLLs and FPGA IP datasheets and via llm
8+
* promting.
9+
*
10+
* This is a synthesizable zeroth order PLL model that only
11+
* supports one operating mode: clkout=clkref.
12+
*
13+
* Behavior of control signals such as divpost may differ between
14+
* PLLs. For exact simulation behavior, see the simulation model. As long
15+
* as these values can be set freely via a register this should not be
16+
* a problem in real designs.
817
*
918
*************************************************************************/
10-
module la_pll #(parameter PROP = "", // cell property
11-
parameter NREF = 1, // number of input reference clocks
12-
parameter NOUT = 1, // number of output clocks
13-
parameter REFW = 8, // reference divider width
14-
parameter FBW = 8, // feedback divider width
15-
parameter PW = 8, // post feedback divider/phase width
16-
parameter CW = 1, // control vector width
17-
parameter SW = 1 // status vector width
19+
module la_pll #(parameter PROP = "", // cell property
20+
parameter NIN = 1, // number of input reference clocks
21+
parameter NOUT = 1, // number of output clocks
22+
parameter DIVINW = 8, // iunpyt divider width
23+
parameter DIVFBW = 8, // feedback divider width
24+
parameter DIVOUTW = 8, // output divider width
25+
parameter PHASEW = 8, // phase shift adjust width
26+
parameter CW = 1, // control vector width
27+
parameter SW = 1 // status vector width
1828
)
1929
(
2030
// supplies
21-
inout vdda, // analog supply
22-
inout vdd, // digital core supply
23-
inout vddaux, // aux core supply
24-
inout vss, // common ground
31+
inout vdda, // analog supply
32+
inout vdd, // digital core supply
33+
inout vddaux, // aux core supply
34+
inout vss, // common ground
2535
// clocks
26-
input [NREF-1:0] refclk, // input reference clock
27-
output [NOUT-1:0] clkout, // output clocks
36+
input [NIN-1:0] clkin, // input reference clock
37+
output [NOUT-1:0] clkout, // output clocks
2838
// standard controls
29-
input reset, // active high async reset
30-
input en, // pll enable
31-
input bypass, // pll bypasses
32-
input [NREF-1:0] clksel, // one hot clock selector
33-
input [REFW-1:0] divref, // reference divider
34-
input [FBW-1:0] divfb, // feedback divider
35-
input [NOUT*PW-1:0] divpost, // output divider
36-
input [NOUT*PW-1:0] phaseout, // output phase shift
37-
output locked, // pll is locked
38-
// user defined controls
39-
input [CW-1:0] ctrl, // user defined controls
40-
output [SW-1:0] status // user defined status
39+
input reset, // active high async reset
40+
input en, // pll enable
41+
input bypass, // pll bypasses
42+
input [NIN-1:0] clksel, // one hot clock selector
43+
input [DIVINW-1:0] divin, // reference divider
44+
input [DIVFBW-1:0] divfb, // feedback divider
45+
input [NOUT*DIVOUTW-1:0] divout, // output divider
46+
input [NOUT*PHASEW-1:0] phase, // output phase shift
47+
output locked, // pll is locked
48+
// user defined signals (defined per unique PLL)
49+
input [CW-1:0] ctrl, // controls
50+
output [SW-1:0] status // status
4151
);
4252

53+
genvar i;
54+
55+
wire clk;
56+
57+
// input clock selector
58+
assign clk = |(clkin[NIN-1:0] & clksel[NIN-1:0]);
4359

60+
// model bypass and pll en
61+
for (i = 0; i < NOUT; i = i + 1) begin : gen_out
62+
assign clkout[i] = bypass ? clk : clk & en;
63+
end
4464

65+
// zero latency lock time
66+
assign locked = en;
4567

4668

4769
endmodule

0 commit comments

Comments
 (0)