def __init__(s, src_tag, opaque, KillOpaqueType): s.src0_val = BitField(1) s.src0_rdy = BitField(1) s.src0 = BitField(canonicalize_type(src_tag).nbits) s.src1_val = BitField(1) s.src1_rdy = BitField(1) s.src1 = BitField(canonicalize_type(src_tag).nbits) # A custom opaque field for passing private info s.opaque = BitField(canonicalize_type(opaque).nbits) s.kill_opaque = BitField(canonicalize_type(KillOpaqueType).nbits) s.ordered = BitField(1) # This is ignore if the interface is not ordered
def __init__(s, inwidth, outwidth): s.In = canonicalize_type(inwidth) s.Out = canonicalize_type(outwidth) super(SextInterface, s).__init__([ MethodSpec( 'sext', args={'in_': s.In}, rets={ 'out': s.Out, }, call=False, rdy=False, ), ])
def __init__(s, dtype, enable=False, bypass=False): s.Data = canonicalize_type(dtype) s.enable = enable s.write_read_bypass = bypass super(RegisterInterface, s).__init__( [ MethodSpec( 'read', args=None, rets={ 'data': s.Data, }, call=False, rdy=False, ), MethodSpec( 'write', args={ 'data': s.Data, }, rets=None, call=enable, rdy=False, ), ], ordering_chains=[s.bypass_chain('write', 'read', bypass)], )
def __init__(s, dtype): s.Data = canonicalize_type(dtype) super(DropUnitInterface, s).__init__([ MethodSpec( 'drop', args=None, rets=None, call=True, rdy=True, ), MethodSpec( 'drop_status', args=None, rets={'occurred': Bits(1)}, call=False, rdy=False, ), MethodSpec( 'output', args=None, rets={ 'data': dtype, }, call=True, rdy=True, ), ],)
def __init__(s, in_type, out_type): s.In = canonicalize_type(in_type) s.Out = canonicalize_type(out_type) super(LookupTableInterface, s).__init__([ MethodSpec( 'lookup', args={ 'in_': s.In, }, rets={ 'out': s.Out, 'valid': Bits(1), }, call=False, rdy=False, ), ])
def __init__(s, In, Out, KillArgType): s.In = canonicalize_type(In) s.Out = canonicalize_type(Out) s.KillArgType = canonicalize_type(KillArgType) check_args = {'in_': In} if KillArgType is not None: check_args['msg'] = KillArgType super(DropControllerInterface, s).__init__([ MethodSpec( 'check', args=check_args, rets={ 'out': Out, 'keep': Bits(1), }, call=False, rdy=False, ), ])
def __init__(s, base_width, max_size): s.Base = canonicalize_type(base_width) s.Size = canonicalize_type(clog2nz(max_size + 1)) super(OverlapCheckerInterface, s).__init__([ MethodSpec( 'check', args={ 'base_a': s.Base, 'size_a': s.Size, 'base_b': s.Base, 'size_b': s.Size, }, rets={ 'disjoint': Bits(1), }, call=False, rdy=False, ), ])
def __init__(s, dtype, clients): s.Data = canonicalize_type(dtype) s.clients = clients interface = PipelineStageInterface(dtype, None) methods = [] for client in clients: for method in interface.methods.values(): methods.append( method.variant(name='{}_{}'.format(client, method.name))) super(PipelineSplitterInterface, s).__init__(methods)
def __init__(s, dtype, stype, nports): s.Data = canonicalize_type(dtype) s.Select = canonicalize_type(stype) s.nports = nports super(CaseMuxInterface, s).__init__([ MethodSpec( 'mux', args={ 'in_': Array(s.Data, nports), 'default': s.Data, 'select': s.Select, }, rets={ 'out': s.Data, 'matched': Bits(1), }, call=False, rdy=False, ), ])
def __init__(s, dtype, nregs, num_read_ports, num_write_ports, write_read_bypass, write_dump_bypass): s.Addr = Bits(clog2nz(nregs)) s.Data = canonicalize_type(dtype) ordering_chains = [ s.bypass_chain('write', 'read', write_read_bypass), s.bypass_chain('write', 'dump', write_dump_bypass), ] + s.successor('set', ['read', 'write', 'dump']) super(RegisterFileInterface, s).__init__( [ MethodSpec('read', args={ 'addr': s.Addr, }, rets={ 'data': s.Data, }, call=False, rdy=False, count=num_read_ports), MethodSpec('write', args={ 'addr': s.Addr, 'data': s.Data, }, rets=None, call=True, rdy=False, count=num_write_ports), MethodSpec( 'dump', args=None, rets={ 'out': Array(s.Data, nregs), }, call=False, rdy=False, ), MethodSpec( 'set', args={ 'in_': Array(s.Data, nregs), }, rets=None, call=True, rdy=False, ), ], ordering_chains=ordering_chains, )
def __init__(s, dtype, nclients): s.Data = canonicalize_type(dtype) s.nclients = nclients s.Spec = Bits(clog2nz(nclients)) super(PipelineSplitterControllerInterface, s).__init__([ MethodSpec( 'sort', args={'msg': s.Data}, rets={'pipe': s.Spec}, call=False, rdy=False, ), ])
def __init__(s, Key, Value): s.Key = canonicalize_type(Key) s.Value = canonicalize_type(Value) super(CAMInterface, s).__init__([ MethodSpec( 'read', args={ 'key': s.Key, }, rets={ 'value': s.Value, 'valid': Bits(1) }, call=False, rdy=False, ), MethodSpec( 'write', args={ 'key': s.Key, 'remove': Bits(1), 'value': s.Value, }, rets=None, call=True, rdy=False, ), MethodSpec( 'clear', args=None, rets=None, call=True, rdy=False, ), ])
def __init__(s, dtype, nports): s.Data = canonicalize_type(dtype) s.Packed = Bits(s.Data.nbits * nports) super(UnpackerInterface, s).__init__([ MethodSpec( 'unpack', args={ 'packed': s.Packed, }, rets={ 'out': Array(s.Data, nports), }, call=False, rdy=False), ])
def __init__(s, dtype): s.Data = canonicalize_type(dtype) super(BinaryComparatorInterface, s).__init__([ MethodSpec( 'compare', args={ 'in_a': s.Data, 'in_b': s.Data, }, rets={ 'out': Bits(1), }, call=False, rdy=False, ), ])
def __init__(s, dtype, nwords, num_read_ports, num_write_ports, write_read_bypass=False): s.Addr = Bits(clog2nz(nwords)) s.Data = canonicalize_type(dtype) s.Bypass = write_read_bypass s.NumWords = nwords ordering_chains = [ s.bypass_chain('write', 'read', write_read_bypass), ] super(SynchronousRAMInterface, s).__init__( [ MethodSpec( 'read_next', args={ 'addr': s.Addr, }, call=False, rdy=False, count=num_read_ports), MethodSpec( 'read', rets={ 'data': s.Data, }, call=False, rdy=False, count=num_read_ports), MethodSpec( 'write', args={ 'addr': s.Addr, 'data': s.Data, }, rets=None, call=True, rdy=False, count=num_write_ports), ], ordering_chains=ordering_chains, )
def __init__(s, dtype, nports): s.Data = canonicalize_type(dtype) s.Select = Bits(clog2nz(nports)) super(MuxInterface, s).__init__([ MethodSpec( 'mux', args={ 'in_': Array(s.Data, nports), 'select': s.Select, }, rets={ 'out': s.Data, }, call=False, rdy=False, ), ])
def __init__(s, addr_len, max_size, nslots): s.nslots = nslots s.max_size = max_size s.StoreID = canonicalize_type(clog2nz(nslots)) s.Addr = canonicalize_type(addr_len) s.Size = canonicalize_type(clog2nz(max_size + 1)) # size is in bytes s.Data = Bits(max_size * 8) super(MemoryFlowManagerInterface, s).__init__([ MethodSpec( 'store_pending', args={ 'live_mask': Bits(nslots), 'addr': s.Addr, 'size': s.Size, }, rets={ 'pending': Bits(1), }, call=False, rdy=False, ), MethodSpec( 'recv_load', args=None, rets={ 'data': s.Data, }, call=True, rdy=True, ), MethodSpec( 'store_data_available', args={ 'id_': s.StoreID, }, rets={ 'ret': Bits(1), }, call=False, rdy=False, ), MethodSpec( 'send_store', args={ 'id_': s.StoreID, }, rets=None, call=True, rdy=True, ), MethodSpec( 'store_acks_outstanding', args=None, rets={ 'ret': Bits(1), }, call=False, rdy=False, ), MethodSpec( 'send_load', args={ 'addr': s.Addr, 'size': s.Size, }, rets=None, call=True, rdy=True, ), MethodSpec( 'register_store', args={ 'id_': s.StoreID, }, rets=None, call=True, rdy=False, ), MethodSpec( 'enter_store_address', args={ 'id_': s.StoreID, 'addr': s.Addr, 'size': s.Size, }, rets=None, call=True, rdy=False, ), MethodSpec( 'enter_store_data', args={ 'id_': s.StoreID, 'data': s.Data, }, rets=None, call=True, rdy=False, ), ])
def canonicalize_method_spec(spec): return dict([(key, canonicalize_type(value)) for key, value in spec.iteritems()])