Changeset 1901 for proto/Compiler


Ignore:
Timestamp:
Jan 28, 2012, 12:31:20 PM (7 years ago)
Author:
ksherdy
Message:

Added ASSERT_BITBLOCK_ALIGN option -b.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/pablo.py

    r1882 r1901  
    429429    return [t, dump_stmt]
    430430
     431#
     432# Adding ASSERT_BITBLOCK_ALIGN macros
     433#
     434class Add_Assert_BitBlock_Align(ast.NodeTransformer):
     435    def xfrm(self, t):
     436      return self.generic_visit(t)
     437    def visit_Assign(self, t):
     438      self.generic_visit(t)
     439      v = t.targets[0]
     440      dump_stmt = mkCallStmt(' ASSERT_BITBLOCK_ALIGN', [v])
     441      return [t, dump_stmt]
     442
    431443class StreamFunctionCarryCounter(ast.NodeVisitor):
    432444  def __init__(self):
     
    646658
    647659class MainLoopTransformer:
    648   def __init__(self, main_module, C_syntax=False, add_dump_stmts=False, main_node_id='Main'):
     660  def __init__(self, main_module, C_syntax=False, add_dump_stmts=False, add_assert_bitblock_align=False, main_node_id='Main'):
    649661       
    650662    self.main_module = main_module
     
    652664    self.use_C_syntax = C_syntax
    653665    self.add_dump_stmts = add_dump_stmts
     666    self.add_assert_bitblock_align = add_assert_bitblock_align
    654667   
    655668        # Gather and partition function definition nodes.
     
    685698                        Add_SIMD_Register_Dump().xfrm(node)
    686699                        Add_SIMD_Register_Dump().xfrm(final_block_node)
    687                
     700
     701                if self.add_assert_bitblock_align:
     702                        Add_Assert_BitBlock_Align().xfrm(node)
     703                        Add_Assert_BitBlock_Align().xfrm(final_block_node)
     704
    688705                if stream_function.carry_count > 0:
    689706                        node.body += [mkCallStmt('carryQ.CarryQ_Adjust', [ast.Num(stream_function.carry_count)])]
     
    749766        Add_SIMD_Register_Dump().xfrm(final_block_main)
    750767               
     768    if self.add_assert_bitblock_align:
     769        Add_Assert_BitBlock_Align().xfrm(self.main_node)
     770        Add_Assert_BitBlock_Align().xfrm(final_block_main)
     771
    751772    StreamFunctionCallXlator().xfrm(self.main_node, self.stream_function_node.keys(), self.use_C_syntax)
    752773    StreamFunctionCallXlator('final').xfrm(final_block_main, self.stream_function_node.keys(), self.use_C_syntax)
Note: See TracChangeset for help on using the changeset viewer.