Beispiel #1
0
def makepico(prog):
    icestick = IceStick()
    icestick.Clock.on()
    for i in range(8):
        icestick.J1[i].input().on()
    for i in range(8):
        icestick.J3[i].output().on()

    main = icestick.main()

    mem = assemble(prog, 1 << ADDRN)

    input, output = pico(mem)

    wire(main.J1, input)
    wire(output, main.J3)

    return main
Beispiel #2
0
import sys
from magma import *
from mantle import *
from parts.lattice.ice40.primitives.RAMB import ROMB
from mem import read as readmem
from seq import Sequencer
from alu import Arith, Logic
from ram import DualRAM
#from io import Input, Output

from boards.icestick import IceStick

icestick = IceStick()

icestick.Clock.on()
for i in range(8):
    icestick.J1[i].input().on()
for i in range(8):
    icestick.J3[i].output().on()

main = icestick.main()

# romb's output is registered
# phase=0
#   fetch()
# phase=1
#   execute()
phase = TFF()(1)

mem = readmem('a.mem', 256)
Beispiel #3
0
import sys
from magma import *
from mantle import *
from rom import ROM
from boards.icestick import IceStick

icestick = IceStick()
icestick.Clock.on()
icestick.TX.output().on()
icestick.RTS.input().on()
icestick.CTS.input().on()
icestick.DTR.input().on()
icestick.DSR.input().on()
icestick.DCD.input().on()

icestick.D1.on()
icestick.D2.on()
icestick.D3.on()
icestick.D4.on()
icestick.D5.on()

main = icestick.main()


def my_baud():
    return 1


baud = my_baud()

PACKETSIZE = 510 * 8
Beispiel #4
0
import sys
from magma import *         # import base stuff from magma (arrays, wires, and other foundational things)
from mantle import *        # import nice stuff from ice40-specific stuff (flip flops, luts, adders, etc)
from boards.icestick import IceStick

icestick = IceStick()       # define the current icestick
icestick.Clock.on()         # enable the clock, of course

# Initialize all LED GPIO connections
icestick.D1.on()
icestick.D2.on()
icestick.D3.on()
icestick.D4.on()
icestick.D5.on()

# Get main connections for icestick
main = icestick.main()

# enable a memory that has 24-bit width connected to the clock (from mantle)
q = Counter(24)

# last bit of clock
clk_out = q.O[23]

# wire the output to the red led
wire(clk_out, main.D5)

# Register to hold current LED
reg_led = Register(2)

# Write only on clk_out positive edge