CIRCT  19.0.0git
sv.py
Go to the documentation of this file.
1 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4 
5 from . import sv, hw
6 from .. import support
7 from .._mlir_libs._circt._sv import *
8 from ..dialects._ods_common import _cext as _ods_cext
9 from ..ir import ArrayAttr, Attribute, FlatSymbolRefAttr, OpView, StringAttr
10 from ._sv_ops_gen import *
11 from ._sv_ops_gen import _Dialect
12 
13 
14 @_ods_cext.register_operation(_Dialect, replace=True)
16 
17  def __init__(self, cond: Attribute, *, loc=None, ip=None):
18  operands = []
19  results = []
20  attributes = {"cond": cond}
21  regions = 2
22  super().__init__(
23  self.build_generic(attributes=attributes,
24  results=results,
25  operands=operands,
26  successors=None,
27  regions=regions,
28  loc=loc,
29  ip=ip))
30  self.regions[0].blocks.append()
31  self.regions[1].blocks.append()
32 
33 
34 @_ods_cext.register_operation(_Dialect, replace=True)
35 class WireOp(WireOp):
36 
37  def __init__(self,
38  data_type,
39  name,
40  *,
41  sym_name=None,
42  svAttributes=None,
43  loc=None,
44  ip=None):
45  attributes = {"name": StringAttr.get(name)}
46  if sym_name is not None:
47  attributes["inner_sym"] = hw.InnerSymAttr.get(StringAttr.get(sym_name))
48  if svAttributes is not None:
49  attributes["svAttributes"] = ArrayAttr.get(svAttributes)
50  OpView.__init__(
51  self,
52  self.build_generic(attributes=attributes,
53  results=[data_type],
54  operands=[],
55  successors=None,
56  regions=0,
57  loc=loc,
58  ip=ip))
59 
60  @staticmethod
61  def create(data_type, name=None, sym_name=None):
62  if not isinstance(data_type, hw.InOutType):
63  data_type = hw.InOutType.get(data_type)
64  return sv.WireOp(data_type, name, sym_name=sym_name)
65 
66 
67 @_ods_cext.register_operation(_Dialect, replace=True)
68 class RegOp(RegOp):
69 
70  def __init__(self,
71  data_type,
72  name,
73  *,
74  sym_name=None,
75  svAttributes=None,
76  loc=None,
77  ip=None):
78  attributes = {"name": StringAttr.get(name)}
79  if sym_name is not None:
80  attributes["inner_sym"] = hw.InnerSymAttr.get(StringAttr.get(sym_name))
81  if svAttributes is not None:
82  attributes["svAttributes"] = ArrayAttr.get(svAttributes)
83  OpView.__init__(
84  self,
85  self.build_generic(attributes=attributes,
86  results=[data_type],
87  operands=[],
88  successors=None,
89  regions=0,
90  loc=loc,
91  ip=ip))
92 
93 
94 @_ods_cext.register_operation(_Dialect, replace=True)
96 
97  @staticmethod
98  def create(dest, src):
99  return sv.AssignOp(dest=dest, src=src)
100 
101 
102 @_ods_cext.register_operation(_Dialect, replace=True)
104 
105  @staticmethod
106  def create(value):
107  value = support.get_value(value)
108  type = support.get_self_or_inner(value.type).element_type
109  return sv.ReadInOutOp(value)
def create(dest, src)
Definition: sv.py:98
Definition: sv.py:15
def __init__(self, Attribute cond, *loc=None, ip=None)
Definition: sv.py:17
def create(value)
Definition: sv.py:106
Definition: sv.py:68
def __init__(self, data_type, name, *sym_name=None, svAttributes=None, loc=None, ip=None)
Definition: sv.py:77
Definition: sv.py:35
def create(data_type, name=None, sym_name=None)
Definition: sv.py:61
def __init__(self, data_type, name, *sym_name=None, svAttributes=None, loc=None, ip=None)
Definition: sv.py:44