Skip to content

Commit

Permalink
reorganization WIP: flatten core structure (SDRAM still needs to be d…
Browse files Browse the repository at this point in the history
…one)
sbourdeauducq committed Sep 23, 2015
1 parent 01be953 commit 8350916
Showing 76 changed files with 104 additions and 437 deletions.
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[submodule "extcores/lm32/submodule"]
path = extcores/lm32/submodule
[submodule "misoc/lm32/verilog/submodule"]
path = misoc/lm32/verilog/submodule
url = https://github.com/m-labs/lm32.git
[submodule "extcores/mor1kx/submodule"]
path = extcores/mor1kx/submodule
[submodule "misoc/mor1kx/verilog"]
path = misoc/mor1kx/verilog
url = https://github.com/openrisc/mor1kx.git
[submodule "software/compiler-rt"]
path = software/compiler-rt
1 change: 0 additions & 1 deletion extcores/lm32/submodule
Submodule submodule deleted from 84b3e3
1 change: 0 additions & 1 deletion extcores/mor1kx/submodule
Submodule submodule deleted from 95fc8e
Empty file.
58 changes: 0 additions & 58 deletions misoc/com/uart/__init__.py

This file was deleted.

9 changes: 0 additions & 9 deletions misoc/com/uart/bridge.py

This file was deleted.

8 changes: 0 additions & 8 deletions misoc/com/uart/phy/__init__.py

This file was deleted.

33 changes: 0 additions & 33 deletions misoc/com/uart/phy/sim.py

This file was deleted.

Empty file.
55 changes: 0 additions & 55 deletions misoc/com/uart/software/reg.py

This file was deleted.

75 changes: 0 additions & 75 deletions misoc/com/uart/software/wishbone.py

This file was deleted.

Empty file removed misoc/cpu/__init__.py
Empty file.
1 change: 1 addition & 0 deletions misoc/dvisampler/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from misoc.dvisampler.core import DVISampler
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
from migen.bank.description import *
from migen.flow.actor import *

from misoc.video.dvisampler.common import channel_layout
from misoc.dvisampler.common import channel_layout


class SyncPolarity(Module):
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
from migen.genlib.misc import optree
from migen.bank.description import *

from misoc.video.dvisampler.common import channel_layout
from misoc.dvisampler.common import channel_layout


class _SyncBuffer(Module):
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
from migen.genlib.misc import optree
from migen.bank.description import *

from misoc.video.dvisampler.common import control_tokens
from misoc.dvisampler.common import control_tokens


class CharSync(Module, AutoCSR):
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions misoc/video/dvisampler/__init__.py → misoc/dvisampler/core.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from migen import *
from migen.bank.description import AutoCSR

from misoc.video.dvisampler.edid import EDID
from misoc.video.dvisampler.clocking import Clocking
from misoc.video.dvisampler.datacapture import DataCapture
from misoc.video.dvisampler.charsync import CharSync
from misoc.video.dvisampler.wer import WER
from misoc.video.dvisampler.decoding import Decoding
from misoc.video.dvisampler.chansync import ChanSync
from misoc.video.dvisampler.analysis import SyncPolarity, ResolutionDetection, FrameExtraction
from misoc.video.dvisampler.dma import DMA
from misoc.dvisampler.edid import EDID
from misoc.dvisampler.clocking import Clocking
from misoc.dvisampler.datacapture import DataCapture
from misoc.dvisampler.charsync import CharSync
from misoc.dvisampler.wer import WER
from misoc.dvisampler.decoding import Decoding
from misoc.dvisampler.chansync import ChanSync
from misoc.dvisampler.analysis import SyncPolarity, ResolutionDetection, FrameExtraction
from misoc.dvisampler.dma import DMA


class DVISampler(Module, AutoCSR):
File renamed without changes.
6 changes: 3 additions & 3 deletions misoc/video/dvisampler/debug.py → misoc/dvisampler/debug.py
Original file line number Diff line number Diff line change
@@ -5,9 +5,9 @@
from migen.actorlib import structuring, spi

from misoc.mem.sdram.frontend import dma_lasmi
from misoc.video.dvisampler.edid import EDID
from misoc.video.dvisampler.clocking import Clocking
from misoc.video.dvisampler.datacapture import DataCapture
from misoc.dvisampler.edid import EDID
from misoc.dvisampler.clocking import Clocking
from misoc.dvisampler.datacapture import DataCapture


class RawDVISampler(Module, AutoCSR):
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from migen import *
from migen.genlib.record import Record

from misoc.video.dvisampler.common import control_tokens, channel_layout
from misoc.dvisampler.common import control_tokens, channel_layout


class Decoding(Module):
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion misoc/video/dvisampler/wer.py → misoc/dvisampler/wer.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
from migen.genlib.misc import optree
from migen.genlib.cdc import PulseSynchronizer

from misoc.video.dvisampler.common import control_tokens
from misoc.dvisampler.common import control_tokens


class WER(Module, AutoCSR):
1 change: 1 addition & 0 deletions misoc/framebuffer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from misoc.framebuffer.core import Framebuffer
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
from migen.actorlib import structuring, misc

from misoc.mem.sdram.frontend import dma_lasmi
from misoc.video.framebuffer.format import bpp, pixel_layout, FrameInitiator, VTG
from misoc.video.framebuffer.phy import Driver
from misoc.framebuffer.format import bpp, pixel_layout, FrameInitiator, VTG
from misoc.framebuffer.phy import Driver


class Framebuffer(Module, AutoCSR):
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions misoc/video/framebuffer/phy.py → misoc/framebuffer/phy.py
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@
from migen.bank.description import *
from migen.flow.actor import *

from misoc.video.framebuffer.format import bpc_phy, phy_layout
from misoc.video.framebuffer import dvi
from misoc.framebuffer.format import bpc_phy, phy_layout
from misoc.framebuffer import dvi


class _FIFO(Module):
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions misoc/integration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from misoc.integration.soc_core import SoCCore
from misoc.integration.soc_sdram import SoCSDRAM
File renamed without changes.
9 changes: 3 additions & 6 deletions misoc/soc/__init__.py → misoc/integration/soc_core.py
Original file line number Diff line number Diff line change
@@ -4,17 +4,14 @@
from migen.bank import csrgen
from migen.bus import wishbone, csr, wishbone2csr

from misoc.com.uart.phy import UARTPHY
from misoc.com import uart
from misoc.cpu import lm32, mor1kx
from misoc.cpu import identifier, timer
from misoc import lm32, mor1kx, identifier, timer, uart


def mem_decoder(address, start=26, end=29):
return lambda a: a[start:end] == ((address >> (start+2)) & (2**(end-start))-1)


class SoC(Module):
class SoCCore(Module):
csr_map = {
"crg": 0, # user
"uart_phy": 1, # provided by default (optional)
@@ -102,7 +99,7 @@ def __init__(self, platform, clk_freq,
self.register_mem("csr", self.mem_map["csr"], self.wishbone2csr.wishbone)

if with_uart:
self.submodules.uart_phy = UARTPHY(platform.request("serial"), clk_freq, uart_baudrate)
self.submodules.uart_phy = uart.RS232PHY(platform.request("serial"), clk_freq, uart_baudrate)
self.submodules.uart = uart.UART(self.uart_phy)

if with_identifier:
4 changes: 2 additions & 2 deletions misoc/soc/sdram.py → misoc/integration/soc_sdram.py
Original file line number Diff line number Diff line change
@@ -6,10 +6,10 @@
from misoc.mem.sdram.core.lasmicon import LASMIconSettings
from misoc.mem.sdram.core.minicon import MiniconSettings
from misoc.mem.sdram.frontend import memtest, wishbone2lasmi
from misoc.soc import SoC
from misoc.integration.soc_core import SoCCore


class SDRAMSoC(SoC):
class SoCSDRAM(SoCCore):
csr_map = {
"sdram": 8,
"l2_cache": 9,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file removed misoc/mem/__init__.py
Empty file.
Empty file removed misoc/mem/flash/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions misoc/spi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from misoc.spi.core import SPIMaster
4 changes: 1 addition & 3 deletions misoc/com/spi/__init__.py → misoc/spi/core.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ def __init__(self, pads, width=24, div=2, cpha=1):

self.irq = Signal()

###
###

# ctrl
start = Signal()
@@ -33,7 +33,6 @@ def __init__(self, pads, width=24, div=2, cpha=1):

# clk
i = Signal(max=div)
clk_en = Signal()
set_clk = Signal()
clr_clk = Signal()
self.sync += [
@@ -124,7 +123,6 @@ def __init__(self, pads, width=24, div=2, cpha=1):

# mosi
if hasattr(pads, "mosi"):
mosi = Signal()
sr_mosi = Signal(width)

# (cpha = 1: propagated on clk rising edge)
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file removed misoc/tools/__init__.py
Empty file.
149 changes: 0 additions & 149 deletions misoc/tools/wishbone.py

This file was deleted.

1 change: 1 addition & 0 deletions misoc/uart/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from misoc.uart.core import UART, RS232PHY
72 changes: 64 additions & 8 deletions misoc/com/uart/phy/serial.py → misoc/uart/core.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from migen import *
from migen.genlib.cdc import MultiReg
from migen.bank.description import *
from migen.flow.actor import Sink, Source
from migen.bank.eventmanager import *
from migen.genlib.record import Record
from migen.actorlib.fifo import SyncFIFO, AsyncFIFO


class UARTPHYSerialRX(Module):
class RS232PHYRX(Module):
def __init__(self, pads, tuning_word):
self.source = Source([("data", 8)])

###

uart_clk_rxen = Signal()
phase_accumulator_rx = Signal(32)

@@ -54,10 +57,12 @@ def __init__(self, pads, tuning_word):
)


class UARTPHYSerialTX(Module):
class RS232PHYTX(Module):
def __init__(self, pads, tuning_word):
self.sink = Sink([("data", 8)])
###

# # #

uart_clk_txen = Signal()
phase_accumulator_tx = Signal(32)

@@ -96,9 +101,60 @@ def __init__(self, pads, tuning_word):
]


class UARTPHYSerial(Module, AutoCSR):
class RS232PHY(Module, AutoCSR):
def __init__(self, pads, clk_freq, baudrate=115200):
self._tuning_word = CSRStorage(32, reset=int((baudrate/clk_freq)*2**32))
self.submodules.tx = UARTPHYSerialTX(pads, self._tuning_word.storage)
self.submodules.rx = UARTPHYSerialRX(pads, self._tuning_word.storage)
self.submodules.tx = RS232PHYTX(pads, self._tuning_word.storage)
self.submodules.rx = RS232PHYRX(pads, self._tuning_word.storage)
self.sink, self.source = self.tx.sink, self.rx.source


def _get_uart_fifo(depth, sink_cd="sys", source_cd="sys"):
if sink_cd != source_cd:
fifo = AsyncFIFO([("data", 8)], depth)
return ClockDomainsRenamer({"write": sink_cd, "read": source_cd})(fifo)
else:
return SyncFIFO([("data", 8)], depth)


class UART(Module, AutoCSR):
def __init__(self, phy,
tx_fifo_depth=16,
rx_fifo_depth=16,
phy_cd="sys"):
self._rxtx = CSR(8)
self._txfull = CSRStatus()
self._rxempty = CSRStatus()

self.submodules.ev = EventManager()
self.ev.tx = EventSourceProcess()
self.ev.rx = EventSourceProcess()
self.ev.finalize()

# # #

# TX
tx_fifo = _get_uart_fifo(tx_fifo_depth, source_cd=phy_cd)
self.submodules += tx_fifo

self.comb += [
tx_fifo.sink.stb.eq(self._rxtx.re),
tx_fifo.sink.data.eq(self._rxtx.r),
self._txfull.status.eq(~tx_fifo.sink.ack),
Record.connect(tx_fifo.source, phy.sink),
# Generate TX IRQ when tx_fifo becomes non-full
self.ev.tx.trigger.eq(~tx_fifo.sink.ack)
]

# RX
rx_fifo = _get_uart_fifo(rx_fifo_depth, sink_cd=phy_cd)
self.submodules += rx_fifo

self.comb += [
Record.connect(phy.source, rx_fifo.sink),
self._rxempty.status.eq(~rx_fifo.source.stb),
self._rxtx.w.eq(rx_fifo.source.data),
rx_fifo.source.ack.eq(self.ev.rx.clear),
# Generate RX IRQ when tx_fifo becomes non-empty
self.ev.rx.trigger.eq(~rx_fifo.source.stb)
]
File renamed without changes.
Empty file removed misoc/video/__init__.py
Empty file.
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -5,10 +5,9 @@
from setuptools import find_packages


required_version = (3, 3)
if sys.version_info < required_version:
raise SystemExit("MiSoC requires python {0} or greater".format(
".".join(map(str, required_version))))
if sys.version_info[:3] < (3, 3):
raise SystemExit("You need Python 3.3+")


setup(
name="misoc",

0 comments on commit 8350916

Please sign in to comment.