In [ ]:
import magma as m
m.set_mantle_target("ice40")
from loam.boards.icestick import IceStick
N = 8
icestick = IceStick()
# TODO: Configure parts (GPIO, clock)
In [ ]:
import mantle
main = icestick.main()
# TODO: Define main
m.EndDefine()
In [ ]:
m.compile('build/pwm', main)
In [ ]:
%%bash
cd build
cat pwm.pcf
yosys -q -p 'synth_ice40 -top main -blif pwm.blif' pwm.v
arachne-pnr -q -d 1k -o pwm.txt -p pwm.pcf pwm.blif
icepack pwm.txt pwm.bin
iceprog pwm.bin
Wire up the GPIO pin to a logic analyzer to verify that our circuit produces the correct waveform.