0

Is there any way to configure the iCE40 Ultra Plus 5k PLL without using the fancy propietary tools like Lattice Icecube2 / Radiant software.

Official PLL programming guide (source) only shows how to use mentioned propietary GUI tools (ch. 4)

71GA
  • 1,132
  • 6
  • 36
  • 69

1 Answers1

2

Those tools simple generate the files needed. In the end it looks like this:

module main_pll(REFERENCECLK,
            PLLOUTCORE,
            PLLOUTGLOBAL,
            RESET);

input REFERENCECLK;
input RESET;    /* To initialize the simulation properly, the RESET signal (Active Low) must be asserted at the beginning of the simulation */ 
output PLLOUTCORE;
output PLLOUTGLOBAL;

SB_PLL40_CORE main_pll_inst(.REFERENCECLK(REFERENCECLK),
                            .PLLOUTCORE(PLLOUTCORE),
                            .PLLOUTGLOBAL(PLLOUTGLOBAL),
                            .EXTFEEDBACK(),
                            .DYNAMICDELAY(),
                            .RESETB(RESET),
                            .BYPASS(1'b0),
                            .LATCHINPUTVALUE(),
                            .LOCK(),
                            .SDI(),
                            .SDO(),
                            .SCLK());

//\\ Fin=13.56, Fout=40.68;
defparam main_pll_inst.DIVR = 4'b0000;
defparam main_pll_inst.DIVF = 7'b0101111;
defparam main_pll_inst.DIVQ = 3'b100;
defparam main_pll_inst.FILTER_RANGE = 3'b001;
defparam main_pll_inst.FEEDBACK_PATH = "SIMPLE";
defparam main_pll_inst.DELAY_ADJUSTMENT_MODE_FEEDBACK = "FIXED";
defparam main_pll_inst.FDA_FEEDBACK = 4'b0000;
defparam main_pll_inst.DELAY_ADJUSTMENT_MODE_RELATIVE = "FIXED";
defparam main_pll_inst.FDA_RELATIVE = 4'b0000;
defparam main_pll_inst.SHIFTREG_DIV_MODE = 2'b00;
defparam main_pll_inst.PLLOUT_SELECT = "GENCLK";
defparam main_pll_inst.ENABLE_ICEGATE = 1'b0;

endmodule

However, the use of the tools is recommended to correctly set all the parameters. Any reason against using the freely available tools to generate the files and then use it elsewise?

Christian B.
  • 816
  • 6
  • 11
  • Macros e.g. `REFERENCECLK` are recognized by open source icestorm tools? – 71GA May 20 '21 at 13:21
  • 1
    I do not see a macro there. REFERENCECLK is an regular input wire. – Christian B. May 20 '21 at 17:51
  • Ok... but when I write `REFERENCECLK` in a verilog file. What does the open source toolchain (`yosys`, `arachne-pnr`, `icestorm`) do with it so that it gets properly connected in the end? By properly connected I mean how does the toolchain connect this to the **internal** PLL. I know that for **external** pins I can simply write a physical constraints file... What about **internal** connections? – 71GA May 20 '21 at 19:12
  • 1
    What happens in this file is basically "passing" the wires from the module definition to the "technology-defined" module of type SB_PLL40_CORE named main_pll_inst. In the end it is just another module which acts like a blackbox and is provided by the embedded lib. The module needs several parameters correctly set to function properly. Providing those setting is the main purpose of this file. In the end is its nothing more than a "wrapper". – Christian B. May 20 '21 at 21:44
  • So here you are actually talking about the `SB_PLL40_CORE` inside the iCE technology library: https://www.latticesemi.com/view_document?document_id=52206 *(page 94)*. I see... so you can target this one by defining a module `main_pll` and then instantiate the `main_pll_inst` of type `SB_PLL40_CORE` and pass values *(not all)* of module `main_pll` to the `main_pll_inst`. So if I wanted to use a different PLL core i.e. the one on page 105 I would have to just instantiate `main_pll_inst` of type `SB_PLL40_2F_CORE`? Probably command `icepack` knows how to connect this & create bitstream file... – 71GA May 21 '21 at 06:19
  • 1
    See [icepll: option to save PLL config to VHDL entity (when using -m) #265](https://github.com/YosysHQ/icestorm/pull/265/files) Added lines 382 to 443. An SB_PLL40_CORE component is declared and generic constant default values are used to pass parameters to an instantiated library primitive during elaboration. –  May 23 '21 at 13:14
  • @user1155120 I tried to continue [here](https://stackoverflow.com/questions/68113130/ice40-ultra-plus-5k-how-to-set-pll-without-propietary-gui-tools-continued) and it looks like Yosys can't find the libraries... – 71GA Jun 24 '21 at 09:52