Esempio n. 1
0
    def __init__(self,
                 ret_type,
                 param_list=ast.NamedObjList(),
                 decls=ast.NamedObjList(),
                 body=ast.NamedObjList(),
                 kind="pure",
                 is_op=False,
                 *,
                 name="",
                 src_loc_at=1):
        #--------
        super().__init__(param_list,
                         decls,
                         body,
                         name=name,
                         src_loc_at=src_loc_at + 1)
        #--------
        assert isinstance(ret_type, ast.InstableTypeBase), \
         do_type_assert_psconcat(ret_type)
        self.__ret_type = ret_type

        Kind = Function.Kind

        STR_KIND_MAP \
         = {
          "pure": Kind.Pure,
          "impure": Kind.Impure,
         }

        self.__kind = convert_str_to_enum_opt(kind, Kind, STR_KIND_MAP)

        self.__is_op = is_op
Esempio n. 2
0
    def __init__(self,
                 generics=ast.NamedObjList(),
                 ports=ast.NamedObjList(),
                 decls=ast.NamedObjList(),
                 archs=ast.NamedObjList(),
                 *,
                 name="",
                 src_loc_at=1):
        #--------
        ast.Base.__init__(self, src_loc_at=src_loc_at + 1)
        ast.HasNameBase.__init__(self, name=name)
        #--------
        assert isinstance(generics, ast.NamedObjList), \
         do_type_assert_psconcat(generics)
        self.__generics = generics

        assert isinstance(ports, ast.NamedObjList), \
         do_type_assert_psconcat(ports)
        self.__ports = ports

        # declarations
        assert isinstance(decls, ast.NamedObjList), \
         do_type_assert_psconcat(decls)
        self.__decls = decls

        # architectures
        assert isinstance(archs, ast.NamedObjList), \
         do_type_assert_psconcat(archs)
        self.__archs = archs
Esempio n. 3
0
    def __init__(self,
                 sens_lst=[],
                 decls=ast.NamedObjList(),
                 body=ast.NamedObjList(),
                 *,
                 name="",
                 src_loc_at=1):
        #--------
        ConcurStmtBase.__init__(self, name=name, src_loc_at=src_loc_at + 1)
        ast.DslBehavBase.__init__(self, body)
        #--------
        assert (isinstance(sens_lst, list) or isinstance(sens_lst, All)), \
         do_type_assert_psconcat(sens_lst)

        if isinstance(sens_lst, list):
            for i in range(len(sens_lst)):
                elem = sens_lst[elem]
                assert (isinstance(elem, ast.Signal)
                 or isinstance(elem, ast.Port)), \
                 psconcat("{}, {}, {}, {}", sens_lst, i, elem,
                  type(elem))
                if isinstance(elem, ast.Port):
                    assert (elem.has_typical_direction()), \
                     psconcat("{}, {}, {}, {}", sens_lst, i,
                      elem.direction(), type(elem.direction()))

        self.__sens_lst = sens_lst

        assert isinstance(decls, ast.NamedObjList), \
         do_type_assert_psconcat(decls)
        self.__decls = decls
Esempio n. 4
0
    def __init__(self,
                 generics=ast.NamedObjList(),
                 generic_map=None,
                 ports=ast.NamedObjList(),
                 port_map=None,
                 body=ast.NamedObjList(),
                 guard_cond=None,
                 *,
                 name="",
                 src_loc_at=1):
        #--------
        super().__init__(name=name, src_loc_at=src_loc_at + 1)
        #--------
        self.__generics = generics

        assert (generic_map is None
         or isinstance(generic_map, GenericMap)), \
         do_type_assert_psconcat(generic_map)
        self.__generic_map = generic_map

        self.__ports = ports

        assert (port_map is None or isinstance(port_map, PortMap)), \
         do_type_assert_psconcat(port_map)
        self.__port_map = port_map

        assert isinstance(body, ast.NamedObjList), \
         do_type_assert_psconcat(body)
        self.__body = body

        #assert isinstance(guard_cond, ast.Expr), \
        #	do_type_assert_psconcat(guard_cond)

        ast.Expr.assert_valid(guard_cond)
        self.__guard_cond = ast.BasicLiteral.cast_opt(guard_cond)
Esempio n. 5
0
 def __init__(self,
              param_list=ast.NamedObjList(),
              decls=ast.NamedObjList(),
              body=ast.NamedObjList(),
              *,
              name="",
              src_loc_at=1):
     super().__init__(param_list,
                      decls,
                      body,
                      name=name,
                      src_loc_at=src_loc_at + 1)
Esempio n. 6
0
	def __init__(self, body=ast.NamedObjList()):
		#--------
		assert isinstance(body, ast.NamedObjList), \
			do_type_assert_psconcat(body)
		self.__body = body

		self.__nodes = []
Esempio n. 7
0
    def __init__(self,
                 generics=ast.NamedObjList(),
                 ports=ast.NamedObjList(),
                 *,
                 name="",
                 src_loc_at=1):
        #--------
        ast.Base.__init__(self, src_loc_at=src_loc_at + 1)
        ast.HasNameBase.__init__(self, name=name)
        #--------
        assert isinstance(generics, ast.NamedObjList), \
         do_type_assert_psconcat(generics)
        self.__generics = generics

        assert isinstance(ports, ast.NamedObjList), \
         do_type_assert_psconcat(ports)
        self.__ports = ports
Esempio n. 8
0
    def __init__(self,
                 param_list=ast.NamedObjList(),
                 decls=ast.NamedObjList(),
                 body=ast.NamedObjList(),
                 *,
                 name="",
                 src_loc_at=1):
        #--------
        ast.Base.__init__(self, src_loc_at=src_loc_at + 1)
        ast.HasNameBase.__init__(self, name=name)
        ast.DslBehavBase.__init__(self, body=body)
        #--------
        assert isinstance(param_list, ast.NamedObjList), \
         do_type_assert_psconcat(param_list)
        self.__param_list = param_list

        assert isinstance(decls, ast.NamedObjList), \
         do_type_assert_psconcat(decls)
        self.__decls = decls
Esempio n. 9
0
    def __init__(self,
                 decls=ast.NamedObjList(),
                 body=ast.NamedObjList(),
                 *,
                 name="",
                 src_loc_at=1):
        #--------
        ast.Base.__init__(self, src_loc_at=src_loc_at + 1)
        ast.HasNameBase.__init__(self, name=name)
        #--------
        # declarations
        assert isinstance(decls, ast.NamedObjList), \
         do_type_assert_psconcat(decls)
        self.__decls = decls

        # Unlabelled statements body
        assert isinstance(body, ast.NamedObjList), \
         do_type_assert_psconcat(body)
        self.__body = body
Esempio n. 10
0
	def __init__(self, cond, body=ast.NamedObjList(), *,
		src_loc_at=1):
		#--------
		super().__init__(src_loc_at=src_loc_at + 1)
		#--------
		ast.Expr.assert_valid(cond)
		self.__cond = ast.BasicLiteral.cast_opt(cond)

		assert isinstance(body, ast.NamedObjList), \
			do_type_assert_psconcat(body)
		self.__body = body
Esempio n. 11
0
	def __init__(self, expr, body=ast.NamedObjList(), *, name="",
		src_loc_at=1):
		#--------
		super().__init__(name=name, src_loc_at=src_loc_at + 1)
		#--------
		ast.Expr.assert_valid(expr)
		self.__expr = ast.BasicLiteral.cast_opt(expr)

		assert isinstance(body, ast.NamedObjList), \
			do_type_assert_psconcat(body)
		self.__body = body
Esempio n. 12
0
	def __init__(self, choices, body=ast.NamedObjList(), *,
		src_loc_at=1):
		#--------
		super().__init__(src_loc_at=src_loc_at + 1)
		#--------
		# One of the choices can be `Others`.
		assert isinstance(choices, list), \
			do_type_assert_psconcat(choices)
		self.__choices = choices

		assert isinstance(body, ast.NamedObjList), \
			do_type_assert_psconcat(body)
		self.__body = body
Esempio n. 13
0
	def __init__(self, decls=ast.NamedObjList(),
		block_config=BlockConfig(), entity, *, name="", src_loc_at=1):
		#--------
		ast.Base.__init__(self, src_loc_at=src_loc_at + 1)
		ast.HasNameBase.__init__(self, name=name)
		#--------
		self.__decls = decls

		assert isinstance(block_config, BlockConfig), \
			do_type_assert_psconcat(block_config)
		self.__block_config = block_config

		assert isinstance(entity, ast.Entity), \
			do_type_assert_psconcat(entity)
		self.__entity = entity
Esempio n. 14
0
	def __init__(self, var_name, rang, body=ast.NamedObjList(), *,
		name="", src_loc_at=1):
		#--------
		super().__init__(name=name, src_loc_at=src_loc_at + 1)
		#--------
		assert isinstance(var_name, ast.SmplName), \
			do_type_assert_psconcat(var_name)
		self.__var_name = var_name

		assert isinstance(rang, ast.ConRangeBase), \
			do_type_assert_psconcat(rang)
		self.__rang = rang

		assert isinstance(body, ast.NamedObjList), \
			do_type_assert_psconcat(body)
		self.__body = body
Esempio n. 15
0
	def __init__(self, body=ast.NamedObjList(), *, src_loc_at=1):
		super().__init__(src_loc_at=src_loc_at + 1)

		assert isinstance(body, ast.NamedObjList), \
			do_type_assert_psconcat(body)
		self.__body = body