Ignore:
Timestamp:
Nov 27, 2012, 6:45:43 AM (7 years ago)
Author:
cameron
Message:

Support Advance(x,n) in experimental mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/CCGO.py

    r2693 r2697  
    2828    def GenerateCarryInAccess(self, operation_no): return None
    2929    def GenerateCarryOutStore(self, operation_no, carry_out_expr): return []
     30    def GenerateAdvanceInAccess(self, operation_no): return None
     31    def GenerateAdvanceOutStore(self, operation_no, carry_out_expr): return []
    3032    def GenerateCarryIfTest(self, block_no, ifTest): return ifTest
    3133    def GenerateCarryElseFinalization(self, block_no): return []
     
    5961        self.carryGroupVar = carryGroupVarName
    6062        self.carryIndex = {}
     63        self.advIndex = {}
    6164        self.operation_offset = 0
    6265        carry_counter = 0
     66        adv_counter = 0
    6367        for op_no in range(carryInfoSet.operation_count):
    6468          self.carryIndex[op_no] = carry_counter
    6569          if not op_no in carryInfoSet.advance_amount.keys(): carry_counter += 1
    6670          elif carryInfoSet.advance_amount[op_no] == 1: carry_counter += 1
     71          else: 
     72            self.advIndex[op_no] = adv_counter
     73            adv_counter += 1
    6774        # Add a dummy entry for any possible final block that is empty.
    6875        self.carryIndex[carryInfoSet.operation_count] = carry_counter
     76        self.advIndex[carryInfoSet.operation_count] = adv_counter
     77        self.carry_count = carry_counter
    6978    # Helper
    7079    def CarryGroupAtt(self, attname, CarryGroupVarName=""):
     
    97106        return [ast.Assign([ast.Subscript(self.CarryGroupAtt('cq'), ast.Index(ast.Num(carry_index)), ast.Store())],
    98107                          mkCall("bitblock::srli<127>", [carry_out_expr]))]
     108    def GenerateAdvanceInAccess(self, operation_no):
     109        adv_index = self.advIndex[operation_no - self.operation_offset]
     110        return mkCall(self.carryGroupVar + "." + 'get_pending64', [ast.Num(adv_index)])
     111    def GenerateAdvanceOutStore(self, operation_no, adv_out_expr):
     112        adv_index = self.advIndex[operation_no - self.operation_offset]
     113        cq_index = adv_index + self.carry_count
     114        return [ast.Assign([ast.Subscript(self.CarryGroupAtt('cq'), ast.Index(ast.Num(cq_index)), ast.Store())], adv_out_expr)]
     115#                          mkCall("bitblock::srli<127>", [carry_out_expr]))]
    99116    def GenerateCarryIfTest(self, block_no, ifTest):
    100117        carry_count = self.carryInfoSet.block_op_count[block_no]
Note: See TracChangeset for help on using the changeset viewer.