示例#1
0
文件: pyast.py 项目: mfkiwl/kratos
 def assert_(self, value, f_ln=None, **kargs):
     assert isinstance(value, (_kratos.Var, int))
     if isinstance(value, int):
         assert value == 0
         value = _kratos.constant(0, 1, False)
     stmt = _kratos.AssertValueStmt(value)
     if self.generator.debug:
         stmt.add_fn_ln((self.filename, f_ln + self.ln - 1), True)
         if self.add_local:
             # obtain the previous call frame info
             __local = get_frame_local()
             add_scope_context(stmt, __local)
             # this is additional info passed in
             add_scope_context(stmt, kargs)
     return stmt
示例#2
0
 def __call__(self, value, is_signed=False):
     return _kratos.constant(value, width, is_signed)
示例#3
0
def const(value: int, width: int, is_signed: bool = False):
    return _kratos.constant(value, width, is_signed)