Using Apio/Atom with PLL changes on the BX - need an example project


I’m looking for a very simple example that sets up the PLL to be a custom clock source and which blinks the LED. When I use icepll to generate a source I get various warnings and errors (particularly fatal error: no set_io constraints for pinclk_out’`). I think a very basic example would set me straight here…


Can you upload your entire project directory?


The source files are attached. There’s nothing fancy here - this is the blink example with a pll.v thrown in, as generated by:

apio\packages\toolchain-icestorm\bin\icepll.exe -i 16 -i 50 -m -f pll.v (3.4 KB)

I’m just not sure how to wire it together. I have a lint error in pll.v (error: Unknown module type SB_PLL40_CORE) and the build fails with fatal error: no set_io constraints for pin 'clock_in'

I’ve tried a few permutations of CLK and so on, but I don’t have a lot to go on (and I’m still waiting to be able to download the standard IDE, at least so I have something I can refer to and learn from).

Edit: Note that this is the basic, unpermuted version - blink + a generated pll.v - my efforts to hook the two together were just confusing things even more.


Note: I just now was finally able to get and install iCEcube2. I did a quick clock generate from there and it’s quite different from what I got from icepll. I’m not sure how much that matters though.


Maybe this can help…

icecube2 software generates two files: pll_inst.v and pll.v

inst file is included in the project. it instantiates the pll.

copy the contents of pll.v into your top.v to define the pll.

like this i think…

***file added below


sorry i will add the files instead… (5.3 KB)


I appreciate the example, but does it actually utilize mypll? It’s present even though the linter thinks it’s not (and still doesn’t know what SB_PLL40_CORE is either), but I don’t see how it’s being used in the blinking process at all (it doesn’t seem to have any effect).

(And for all that, the output of icepll is rather different from what ICEcube2 generates, which makes me wonder how icepll is supposed to work in all this.)


have you sen this?


here is the better (20.7 KB)

blinks a faster sos.

note: i changed it from at @posedge CLK
to at @posedge clk_50mhz


It works! I still don’t understand why the warnings exist - e.g.:

Warning: Identifier `\clk_50mhz' is implicitly declared at top.v:14

Nor is it clear why module mypll is “Unknown” (and I’m seeing all kinds of “scope” warnings in the module now as well).

But I can experiment with it now. Thank you!


The warnings are because i have not defined clk_50mgz and clk_global in the proper way.
I am not sure how in verilog. But the linter doesn’t know about source file directories.
Maybe if you find a way to inform the linter in some file inside atom’s options, but I am not sure which one.
The CLK is 16mgz on board. In your original project it said you inputted 50mhz as input
and 60mhz as output. If you use an external clock it is slightly different settings in icecube2.
It’s a start anyway :stuck_out_tongue: 2am so I better scoot to sleep :slight_smile: cheers


Ah, my command line had a bug! Two -i options, no -o. Thanks for catching that, and thanks for your help!


Hi there
Anyone tried to create a testbench for the above sample. For me there are signals in the output. Think some files are missing because I get errors of unknown module type: SB_PLL_40_CORE and some others. The .bin is wirking as I see the LEDs flashing and an output on pin_17 gives me correct reading for 50MHz pulse on my oszi.
Thanxs for help and regards, harald.