Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: whitequark/Boneless-CPU
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: abad3c2510cb
Choose a base ref
...
head repository: whitequark/Boneless-CPU
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5dd020b80d68
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 10, 2019

  1. Copy the full SHA
    db09d38 View commit details
  2. Copy the full SHA
    c0a6808 View commit details
  3. Copy the full SHA
    5dd020b View commit details
Showing with 15 additions and 4 deletions.
  1. +6 −3 boneless/gateware/core_v3.py
  2. +9 −1 boneless/gateware/decoder_v3.py
9 changes: 6 additions & 3 deletions boneless/gateware/core_v3.py
Original file line number Diff line number Diff line change
@@ -110,16 +110,18 @@ def elaborate(self, platform):


class CoreFSM(Elaboratable):
def __init__(self, alsru_cls, memory=None):
self.r_pc = Signal(16)
self.r_w = Signal(13)
def __init__(self, alsru_cls, reset_pc=0, reset_w=0xffff, memory=None):
self.r_pc = Signal(16, reset=reset_pc)
self.r_w = Signal(13, reset=reset_w >> 3)
self.r_f = Record([("z", 1), ("s", 1), ("c", 1), ("v", 1)])

self.r_insn = Signal(16)
self.r_a = Signal(16)
self.s_b = Signal(16)
self.s_f = Record(self.r_f.layout)

self.o_done = Signal()

self.m_dec = InstructionDecoder(alsru_cls)
self.m_arb = BusArbiter()
self.m_alsru = alsru_cls(width=16)
@@ -249,6 +251,7 @@ def elaborate(self, platform):
m.d.sync += self.r_w .eq(m_alsru.o >> 3)
with m.If(m_dec.o_jump):
m.d.sync += self.r_pc.eq(m_alsru.o)
m.d.comb += self.o_done.eq(1)
m.next = "FETCH"

return m
10 changes: 9 additions & 1 deletion boneless/gateware/decoder_v3.py
Original file line number Diff line number Diff line change
@@ -114,11 +114,19 @@ class Cond(ControlEnum):
SxVoZ = 0b110
A = 0b111

@staticmethod
def _insn_decoder(encoding):
try:
insn = opcode.Instr.from_int(encoding)
return str(insn).expandtabs(1)
except ValueError:
return "{:04x}".format(encoding)

def __init__(self, alsru_cls):
self.alsru_cls = alsru_cls

self.i_pc = Signal(16)
self.i_insn = Signal(16)
self.i_insn = Signal(16, decoder=self._insn_decoder)

self.o_pc_p1 = Signal(16)
self.o_imm16 = Signal(16)