Beispiel #1
0
    def write(self, fsm, addr, wdata, port=0, unified=False, raw=False):
        if raw:
            fixed_wdata = wdata
        else:
            fixed_wdata = fxd.write_adjust(wdata, self.point)

        return RAM.write(self, fsm, addr, fixed_wdata, port, unified)
Beispiel #2
0
    def try_enq(self, fsm, wdata, raw=False):
        if raw:
            fixed_wdata = wdata
        else:
            fixed_wdata = fxd.write_adjust(wdata, self.point)

        return FIFO.try_enq(self, fsm, fixed_wdata)
Beispiel #3
0
    def try_enq(self, fsm, wdata, raw=False):
        if raw:
            fixed_wdata = wdata
        else:
            fixed_wdata = fxd.write_adjust(wdata, self.point)

        return FIFO.try_enq(self, fsm, fixed_wdata)
Beispiel #4
0
def FixedConst(fsm, value, point=0, signed=True, raw=False):
    point = vtypes.raw_value(point)
    signed = vtypes.raw_value(signed)
    raw = vtypes.raw_value(raw)

    if (isinstance(value, fxd._FixedConstant)
            and value.orig_value is not None):
        value = value.orig_value
    elif isinstance(value, fxd._FixedBase):
        value = fxd.write_adjust(value, point)
        value = vtypes.raw_value(value)
        raw = True
    elif not raw:
        value = vtypes.raw_value(value)

    if not isinstance(value, (int, bool, float)):
        raise TypeError("value must be int, bool, or float")
    if not isinstance(point, int):
        raise TypeError("point must be int")

    return fxd.FixedConst(value, point, signed, raw)
Beispiel #5
0
def FixedConst(fsm, value, point=0, signed=True, raw=False):
    point = vtypes.raw_value(point)
    signed = vtypes.raw_value(signed)
    raw = vtypes.raw_value(raw)

    if (isinstance(value, fxd._FixedConstant) and
            value.orig_value is not None):
        value = value.orig_value
    elif isinstance(value, fxd._FixedBase):
        value = fxd.write_adjust(value, point)
        value = vtypes.raw_value(value)
        raw = True
    elif not raw:
        value = vtypes.raw_value(value)

    if not isinstance(value, (int, bool, float)):
        raise TypeError("value must be int, bool, or float")
    if not isinstance(point, int):
        raise TypeError("point must be int")

    return fxd.FixedConst(value, point, signed, raw)
Beispiel #6
0
def cast_to_fixed(fsm, value, point, signed=True):
    point = vtypes.raw_value(point)
    signed = vtypes.raw_value(signed)
    cv = fxd.write_adjust(value, point)
    return fxd.reinterpret_cast_to_fixed(cv, point, signed)
Beispiel #7
0
def cast_to_fixed(fsm, value, point, signed=True):
    point = vtypes.raw_value(point)
    signed = vtypes.raw_value(signed)
    cv = fxd.write_adjust(value, point)
    return fxd.reinterpret_cast_to_fixed(cv, point, signed)