Ejemplo n.º 1
0
 def _parse_operands(self):
     '''set v.parsed_operands with list of operand_info_t objects (see opnds.py).'''
     for v in self.recs:
         v.parsed_operands = []
         for op_str in v.operand_list:
             #op is an operand_info_t  object
             op = opnds.parse_one_operand(op_str, 'DEFAULT', self.xtypes,
                                          self.widths_dict)
             v.parsed_operands.append(op)
Ejemplo n.º 2
0
 def _parse_operands(self):
     '''set v.parsed_operands with list of operand_info_t objects (see opnds.py).'''
     for v in self.recs:
         v.operand_list = v.operands.split()
         v.parsed_operands = []
         for op_str in v.operand_list:
             #op is an operand_info_t  object
             op = opnds.parse_one_operand(op_str,
                                          'DEFAULT',
                                          self.xtypes,
                                          self.width_type_dict,
                                          skip_encoder_conditions=False)
             v.parsed_operands.append(op)
Ejemplo n.º 3
0
def _set_space_from_operands(agi, operands, state_space):
    state_dict = agi.common.state_bits
    for op in operands:
        ops = []
        #if binding operand is a macro
        if op.name.lower() in state_dict:
            op_spec = state_dict[op.name.lower()].list_of_str
            found_op = False
            for w in op_spec:
                exapnded_op = opnds.parse_one_operand(w)
                ops.append(exapnded_op)
        else:
            ops.append(op)

        for op in ops:
            if (op.bits and op.name in state_space and op.type == 'imm_const'):
                op_val = int(op.bits, 16)
                state_space[op.name][op_val] = True
Ejemplo n.º 4
0
def gen_lookup_dict(agi, nt_name, target_opname, argnames):
    gi = agi.generator_dict[nt_name]
    options = agi.common.options
    state_space = agi.common.state_space
    operand_storage = agi.operand_storage
    

    all_values = [] 
    for ii in gi.parser_output.instructions:
        #First check if current rule sets the operand, if not
        #go to next rule
        target_op = None
        for op in ii.operands:
            if is_target_op(agi, op, target_opname):
                target_op = op
                break
        
        if not target_op:
            continue
        
        state_dict = agi.common.state_bits
        #if binding operand is a macro
        if target_op.name.lower() in state_dict:
            op_spec = state_dict[target_op.name.lower()].list_of_str
            found_op = False
            for w in op_spec:
                if w.startswith(target_opname):
                    found_op = True
                    break
            if not found_op:
                ildutil.ild_err("Failed to find operand %s" % str(target_op))
            expansion = w
            target_op = opnds.parse_one_operand(expansion)
        
        # the operand is the table output value
        if target_op.bits: # RHS of the 1st operand
            this_row_output = target_op.bits
        else:
            ildutil.ild_err("NTLUF operand %s" % str(target_op))
        # Now we must get the table index values as a dictionary
        indices = _generate_lookup_function_indices(ii,state_space,argnames)
        all_values.append((indices,this_row_output))
    return all_values