Beispiel #1
0
from collections import OrderedDict
from myhdl import *
from mn.system import RegisterFile, Register, RegisterBits

regfile = RegisterFile()
# -- a basic configuration register --
regcfg = Register('cfg', 0x00, 8, 'rw', 0)
regcfg.comment = "fifo ramp configuration register"
regcfg.add_named_bits('enable', slice(1, 0), "enable fifo ramp")
regfile.add_register(regcfg)

# -- division register 0 --
# 32-bit clock division register
for ii, regname in enumerate(('div3', 'div2', 'div1', 'div0')):
    regdiv = Register(regname, 0x04 + ii, 8, 'rw', 0)
    regdiv.comment = "division register most significant byte"
    regdiv.add_named_bits('%sb' % (regname), slice(8, 0),
                          "rate control divisor")
    regfile.add_register(regdiv)

# -- number of ramps completed --
# 32-bit
for ii, regname in enumerate(('cnt3', 'cnt2', 'cnt1', 'cnt0')):
    regcnt = Register(regname, 0x08 + ii, 8, 'ro', 0)
    regcnt.comment = "the number of ramp cycles completed"
    regcnt.add_named_bits('%sb' % (regname), slice(8, 0), "count")
    regfile.add_register(regcnt)
Beispiel #2
0
from collections import OrderedDict
from myhdl import *
from mn.system import RegisterFile, Register, RegisterBits


regfile = RegisterFile()
# -- a basic configuration register --
regcfg = Register('cfg',0x00,8,'rw',0)
regcfg.comment = "fifo ramp configuration register"
regcfg.add_named_bits('enable', slice(1,0), "enable fifo ramp")
regfile.add_register(regcfg)

# -- division register 0 --
# 32-bit clock division register
for ii,regname in enumerate(('div3','div2','div1','div0')):
    regdiv = Register(regname,0x04+ii,8,'rw',0)
    regdiv.comment = "division register most significant byte"
    regdiv.add_named_bits('%sb'%(regname),slice(8,0),"rate control divisor")
    regfile.add_register(regdiv)

# -- number of ramps completed --
# 32-bit 
for ii,regname in enumerate(('cnt3','cnt2','cnt1','cnt0')):
    regcnt = Register(regname,0x08+ii,8,'ro',0)
    regcnt.comment = "the number of ramp cycles completed"
    regcnt.add_named_bits('%sb'%(regname),slice(8,0),"count")
    regfile.add_register(regcnt)
                           
Beispiel #3
0
        0x70: SPSS slave select register
        0x74: SPTC transmit fifo count
        0x78: SPRC receive fifo count
        0x7C: SPXX SCK clock divisor (divides wb clk_i)
            0  -- 2 divisor 24 MHz (usbp == 48MHz system clock)
"""

regfile = RegisterFile()
# -- SPI Setup Register 
spst = Register('spst', 0x58, 8, 'rw', 0x00)
spst.add_named_bits('freeze', slice(1,0), 
                    "freeze the core")
spst.add_named_bits('rdata', slice(2,1), 
                    "1 : register file (memmap) feeds TX/RX FIFO")
regfile.add_register(spst)

# -- SPI Control Register (Control Register 0) --
spcr = Register('spcr', 0x60, 8, 'rw', 0x98)
spcr.comment = "SPI control register"
spcr.add_named_bits('loop', slice(1,0), "internal loopback")
spcr.add_named_bits('spe', slice(2,1), "system enable")
spcr.add_named_bits('cpol', slice(4,3), "clock polarity")
spcr.add_named_bits('cpha', slice(5,4), "clock phase")
spcr.add_named_bits('msse', slice(8,7), "manual slave select enable")
regfile.add_register(spcr)

# -- SPI status register --
spsr = Register('spsr', 0x64, 8, 'ro', 0)
spsr.add_named_bits('rxe', slice(1,0), "RX FIFO empty")
spsr.add_named_bits('rxf', slice(2,1), "RX FIFO full")
Beispiel #4
0
        0x6C: SPRX receive register

        0x70: SPSS slave select register
        0x74: SPTC transmit fifo count
        0x78: SPRC receive fifo count
        0x7C: SPXX SCK clock divisor (divides wb clk_i)
            0  -- 2 divisor 24 MHz (usbp == 48MHz system clock)
"""

regfile = RegisterFile()
# -- SPI Setup Register
spst = Register('spst', 0x58, 8, 'rw', 0x00)
spst.add_named_bits('freeze', slice(1, 0), "freeze the core")
spst.add_named_bits('rdata', slice(2, 1),
                    "1 : register file (memmap) feeds TX/RX FIFO")
regfile.add_register(spst)

# -- SPI Control Register (Control Register 0) --
spcr = Register('spcr', 0x60, 8, 'rw', 0x98)
spcr.comment = "SPI control register"
spcr.add_named_bits('loop', slice(1, 0), "internal loopback")
spcr.add_named_bits('spe', slice(2, 1), "system enable")
spcr.add_named_bits('cpol', slice(4, 3), "clock polarity")
spcr.add_named_bits('cpha', slice(5, 4), "clock phase")
spcr.add_named_bits('msse', slice(8, 7), "manual slave select enable")
regfile.add_register(spcr)

# -- SPI status register --
spsr = Register('spsr', 0x64, 8, 'ro', 0)
spsr.add_named_bits('rxe', slice(1, 0), "RX FIFO empty")
spsr.add_named_bits('rxf', slice(2, 1), "RX FIFO full")