Changeset 2790 for proto


Ignore:
Timestamp:
Dec 18, 2012, 6:20:21 AM (7 years ago)
Author:
cameron
Message:

Initial Advance_n support with HMCPS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/CCGO_HMCPS.py

    r2787 r2790  
    178178        self.temp_prefix = temp_prefix
    179179        self.aligned_size = determine_aligned_block_sizes(self.field_count, carryInfoSet)
    180         self.ubitblock_count = (self.aligned_size[0] + self.field_count - 1) / self.field_count
     180        carry_bitblocks = (self.aligned_size[0] + self.field_count - 1) / self.field_count
     181        self.ubitblock_count = carry_bitblocks + carryInfoSet.adv_n_count
    181182        self.alloc_map = {}
    182183        self.alloc_map[0] = 0
     184        self.adv_n_map = {}
    183185        self.block_base = {}
    184186        self.allocate_ops()
     
    281283    def allocate_ops(self):
    282284      carry_count = 0
     285      adv_n_count = 0
    283286      for op in range(self.carryInfoSet.operation_count):
    284287        b = self.carryInfoSet.containing_block[op]
     
    304307          self.alloc_map[op] = carry_count
    305308          carry_count += 1
     309        else:
     310          # Advance_n op, carry_count does not change.
     311          self.alloc_map[op] = carry_count
     312          self.adv_n_map[op] = adv_n_count
     313          adv_n_count += 1
    306314      # When processing the last operation, make sure that the "next" operation
    307315      # appears to start a new pack.
     
    358366          assigs.append(make_assign(self.carry_pack_full(ub, mode = ast.Store()), storable_carry_in_form))
    359367        return assigs
    360     def GenerateAdvanceInAccess(self, operation_no): pass
    361         #adv_index = self.advIndex[operation_no - self.operation_offset]
    362         #return mkCall(self.carryGroupVar + "." + 'get_pending64', [ast.Num(adv_index)])
    363     def GenerateAdvanceOutStore(self, operation_no, adv_out_expr): pass
    364         #adv_index = self.advIndex[operation_no - self.operation_offset]
    365         #cq_index = adv_index + self.carry_count
    366         #return [ast.Assign([ast.Subscript(self.CarryGroupAtt('cq'), ast.Index(ast.Num(cq_index)), ast.Store())],
    367                            #mkCall("bitblock::srli<64>", [adv_out_expr]))]
     368    def GenerateAdvanceInAccess(self, operation_no):
     369        return self.carry_pack_full(self.ubitblock_count + self.adv_n_map[operation_no])
     370    def GenerateAdvanceOutStore(self, operation_no, adv_out_expr):
     371        return [ast.Assign([self.carry_pack_full(self.ubitblock_count + self.adv_n_map[operation_no], mode=ast.Store())],
     372                           make_call("bitblock::srli<64>", [adv_out_expr]))]
    368373    def GenerateTestAll(self, instance_name):
    369374        if self.ubitblock_count == 0: return ast.Num(0)
Note: See TracChangeset for help on using the changeset viewer.