Migen: Difference between revisions
From ArmadeusWiki
(→Links) |
No edit summary |
||
Line 2: | Line 2: | ||
TODO | TODO | ||
== Blink led Example == | |||
=== APF27 === | |||
<source lang="python"> | |||
#!/usr/local/bin/python3.4 | |||
# -*- coding: utf-8 -*- | |||
from migen.fhdl.std import * | |||
from mibuild.generic_platform import Pins, IOStandard | |||
from mibuild.platforms import apf27 | |||
ios = [ | |||
("user_led", 0, Pins("J2:22"), IOStandard("LVCMOS33")) | |||
] | |||
plat = apf27.Platform() | |||
plat.add_extension(ios) | |||
led = plat.request("user_led", 0) # led pin on apf27dev | |||
m = Module() | |||
counter = Signal(26) | |||
m.comb += led.eq(counter[25]) | |||
m.sync += counter.eq(counter + 1) | |||
plat.build_cmdline(m) | |||
</source> | |||
=== APF51 === | |||
<source lang="python"> | |||
#!/usr/local/bin/python3.4 | |||
# -*- coding: utf-8 -*- | |||
from migen.fhdl.std import * | |||
from mibuild.generic_platform import Pins, IOStandard | |||
from mibuild.platforms import apf51 | |||
ios = [ | |||
("user_led", 0, Pins("J2:15"), IOStandard("LVCMOS33")) | |||
] | |||
plat = apf51.Platform() | |||
plat.add_extension(ios) | |||
led = plat.request("user_led", 0) # led pin on apf51dev | |||
m = Module() | |||
counter = Signal(26) | |||
m.comb += led.eq(counter[25]) | |||
m.sync += counter.eq(counter + 1) | |||
plat.build_cmdline(m) | |||
</source> | |||
== Links == | == Links == |
Revision as of 17:22, 9 July 2014
Introduction
TODO
Blink led Example
APF27
#!/usr/local/bin/python3.4
# -*- coding: utf-8 -*-
from migen.fhdl.std import *
from mibuild.generic_platform import Pins, IOStandard
from mibuild.platforms import apf27
ios = [
("user_led", 0, Pins("J2:22"), IOStandard("LVCMOS33"))
]
plat = apf27.Platform()
plat.add_extension(ios)
led = plat.request("user_led", 0) # led pin on apf27dev
m = Module()
counter = Signal(26)
m.comb += led.eq(counter[25])
m.sync += counter.eq(counter + 1)
plat.build_cmdline(m)
APF51
#!/usr/local/bin/python3.4
# -*- coding: utf-8 -*-
from migen.fhdl.std import *
from mibuild.generic_platform import Pins, IOStandard
from mibuild.platforms import apf51
ios = [
("user_led", 0, Pins("J2:15"), IOStandard("LVCMOS33"))
]
plat = apf51.Platform()
plat.add_extension(ios)
led = plat.request("user_led", 0) # led pin on apf51dev
m = Module()
counter = Signal(26)
m.comb += led.eq(counter[25])
m.sync += counter.eq(counter + 1)
plat.build_cmdline(m)