[libre-riscv-dev] [Bug 206] Implement branch prediction

bugzilla-daemon at libre-riscv.org bugzilla-daemon at libre-riscv.org
Sat Mar 7 17:39:11 GMT 2020


--- Comment #26 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
got it:

    def __init__(self, width):
        self.opcode_in = Signal(width, reset_less=False)
        self.df = DecodeFields(SignalBitRange, [self.opcode_in])
        self.x_s = Signal(len(self.df.FormX.S), reset_less=True)
        self.x_sh = Signal(len(self.df.FormX.SH), reset_less=True)
        self.dq_xs_s = Signal(len(self.df.FormDQ.SX_S), reset_less=True)

    def elaborate(self, platform):
        m = Module()
        comb = m.d.comb
        comb += self.x_s.eq(self.df.FormX.S[0])
        comb += self.x_sh.eq(self.df.FormX.SH[0:-1])
        comb += self.dq_xs_s.eq(self.df.FormDQ.SX_S[0:-1])

so the field encodings are picked up from fields.txt, processed in a class
that records the ranges, and creates "pseudo"-accessors which allow the
bits to be indexed 0,1,2,3 rather than having to memorise 20,22,23,24
or refer, repeatedly, to the PDF manual

You are receiving this mail because:
You are on the CC list for the bug.

More information about the libre-riscv-dev mailing list