zuspec-dataclasses 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+
2
+
3
+ # from .activity_stmts import *
4
+ from .decorators import dataclass, field, export, process, input, output, sync, const, port, export, bind
5
+ from .tlm import *
6
+ # from .claims_refs import *
7
+ # from .shared_stmts import *
8
+ # from .types import *
9
+ # from .core_lib import *
10
+ # from vsc_dataclasses.expr import *
11
+
12
+ from .bit import Bit
13
+ from .component import Component
14
+ from .struct import Struct
15
+ from .ports import Input, Output, Port
16
+
17
+ from asyncio import Event
@@ -0,0 +1,4 @@
1
+
2
+ BASE="0.0.1"
3
+ SUFFIX=".17420876924rc0"
4
+ VERSION="%s%s" % (BASE, SUFFIX)
@@ -0,0 +1,25 @@
1
+ from typing import Self, Type, TypeVar
2
+ from .decorators import dataclass, field
3
+ from .component import Component
4
+ from .struct import Struct
5
+
6
+ CompT = TypeVar('CompT', bound=Component)
7
+
8
+ @dataclass
9
+ class Action[CompT](Struct):
10
+ """
11
+ Action-derived types
12
+
13
+ Valid fields
14
+ - All Struct fields
15
+ - Input / Output fields of Buffer, Stream, and State types
16
+ - Lock / Share fields of Resource types
17
+ Valid sub-regions
18
+ - All Struct sub-regions
19
+ - activity
20
+ """
21
+ comp : Type[CompT] = field()
22
+
23
+ @dataclass
24
+ class MyAction(Action[Component]):
25
+ pass
@@ -0,0 +1,61 @@
1
+ import abc
2
+ import zuspec.dataclasses as zdc
3
+ from typing import Annotated, TypeVar, Type, Union
4
+ from .struct import StructPacked
5
+
6
+ class AddrTrait(zdc.Struct): pass
7
+
8
+
9
+ class AddrSpaceBase:
10
+ pass
11
+
12
+ uint64_t = Annotated[int, "abc"]
13
+
14
+ AddrTraitT = TypeVar('AddrTraitT', bound=AddrTrait)
15
+
16
+ class AddrRegion[AddrTraitT]():
17
+ trait : Type[AddrTraitT] = zdc.trait()
18
+ pass
19
+
20
+ class MyTrait(AddrTrait):
21
+ a : int = 5
22
+
23
+ class TransparentAddrSpace[AddrTraitT](AddrSpaceBase):
24
+
25
+ def add_region(self, region : AddrRegion[AddrTraitT]): pass
26
+
27
+ pass
28
+
29
+ class MyAddrTrait(AddrTrait):
30
+ pass
31
+
32
+ class Other(object):
33
+ pass
34
+
35
+ t : TransparentAddrSpace = TransparentAddrSpace()
36
+ o = Other()
37
+
38
+ r = AddrRegion[MyTrait]()
39
+ r2 = AddrRegion[Other]()
40
+
41
+ t.add_region(r2)
42
+
43
+ r.trait.a
44
+
45
+ RegT = TypeVar("RegT", bound=Union[int,StructPacked])
46
+
47
+ class Reg[RegT](object):
48
+
49
+ @abc.abstractmethod
50
+ def read(self) -> Type[RegT]: pass
51
+
52
+ @abc.abstractmethod
53
+ def write(self, data : Type[RegT]): pass
54
+
55
+ class RegGroup(object):
56
+ @abc.abstractmethod
57
+ def get_handle(self): pass
58
+
59
+ @abc.abstractmethod
60
+ def set_handle(self, h): pass
61
+
@@ -0,0 +1,16 @@
1
+ import dataclasses as dc
2
+ from typing import Callable, ClassVar
3
+
4
+ @dc.dataclass
5
+ class Annotation(object):
6
+ NAME : ClassVar[str] = "__zsp_annotation__"
7
+
8
+ @classmethod
9
+ def apply(cls, o, v):
10
+ setattr(o, cls.NAME, v)
11
+ pass
12
+
13
+ @dc.dataclass
14
+ class AnnotationSync(Annotation):
15
+ clock : Callable
16
+ reset : Callable
@@ -0,0 +1,2 @@
1
+
2
+ from .visitor import Visitor
@@ -0,0 +1,64 @@
1
+ import dataclasses as dc
2
+ from typing import Callable, ClassVar, Dict, Type
3
+ from ..annotation import Annotation
4
+ from ..component import Component
5
+ from ..ports import Input, Output
6
+ from ..struct import Struct
7
+
8
+ @dc.dataclass
9
+ class Visitor(object):
10
+ _type_m : Dict[Type,Callable] = dc.field(default_factory=dict)
11
+ _field_factory_m : Dict[Type,Callable] = dc.field(default_factory=dict)
12
+
13
+ def __post_init__(self):
14
+ self._type_m = {
15
+ Component : self.visitComponentType
16
+ }
17
+ self._field_factory_m = {
18
+ Input : self.visitInput,
19
+ Output : self.visitOutput
20
+ }
21
+
22
+ def visit(self, t):
23
+ found = False
24
+ for base_t,method in self._type_m.items():
25
+ if issubclass(t, base_t):
26
+ method(t)
27
+ found = True
28
+ break
29
+ if not found:
30
+ raise Exception("Unsupported class %s" % str(type(t)))
31
+
32
+ def visitComponentType(self, t):
33
+ self.visitStructType(t)
34
+ pass
35
+
36
+ def visitStructType(self, t : Struct):
37
+ for f in dc.fields(t):
38
+ self._dispatchField(f)
39
+
40
+ for f in dir(t):
41
+ o = getattr(t, f)
42
+ if callable(o) and hasattr(o, Annotation.NAME):
43
+ self.visitExec(f, o)
44
+ print("Found")
45
+
46
+ def visitExec(self, name, m):
47
+ pass
48
+
49
+ def _dispatchField(self, f : dc.Field):
50
+ if f.default_factory in self._field_factory_m.keys():
51
+ self._field_factory_m[f.default_factory](f)
52
+ else:
53
+ self.visitField(f)
54
+
55
+ def visitField(self, f : dc.Field):
56
+ pass
57
+
58
+ def visitInput(self, f : dc.Field):
59
+ self.visitField(f)
60
+ pass
61
+
62
+ def visitOutput(self, f : dc.Field):
63
+ self.visitField(f)
64
+ pass
@@ -0,0 +1,26 @@
1
+ import dataclasses as dc
2
+ from typing import Dict
3
+
4
+ class BitMeta(type):
5
+
6
+ def __new__(cls, name, bases, attrs):
7
+ return super().__new__(cls, name, bases, attrs)
8
+
9
+ def __init__(self, name, bases, attrs):
10
+ super().__init__(name, bases, attrs)
11
+ self.type_m : Dict = {}
12
+
13
+ def __getitem__(self, W : int):
14
+ if W in self.type_m.keys():
15
+ return self.type_m[W]
16
+ else:
17
+ t = type("bit[%d]" % W, (Bit,), {
18
+ "T" : W
19
+ })
20
+ self.type_m[W] = t
21
+ return t
22
+
23
+
24
+ class Bit(metaclass=BitMeta):
25
+ T : int = 1
26
+ pass
@@ -0,0 +1,32 @@
1
+ from typing import Annotated, Type, TypeVar
2
+ from .decorators import dataclass
3
+
4
+ @dataclass
5
+ class Bundle(object):
6
+ """
7
+ A bundle type collects one or more ports, exports,
8
+ inputs, outputs, or bundles.
9
+
10
+ Bundle fields are created with field(). Bundle-mirror
11
+ fields are created with mirror() or field(mirror=True)
12
+
13
+ A bundle field can be connected to a mirror field.
14
+ - Bundle
15
+ - Bundle Mirror
16
+ - Bundle Monitor (all are inputs / exports)
17
+ """
18
+ pass
19
+
20
+ #BundleT=TypeVar('BundleT', bound=Bundle)
21
+
22
+ #class Mirror[BundleT](Annotated[Type[BundleT], "is mirror"]): pass
23
+
24
+ # class MirrorMeta[BundleT](type):
25
+
26
+ # def __getitem__(self, t : BundleT) -> BundleT:
27
+ # pass
28
+
29
+ # @dataclass
30
+ # class Mirror[BundleT](metaclass=MirrorMeta[BundleT]):
31
+ # pass
32
+
@@ -0,0 +1,3 @@
1
+
2
+ class Clock(object):
3
+ pass
@@ -0,0 +1,15 @@
1
+ from .decorators import dataclass
2
+ from .struct import Struct
3
+
4
+ @dataclass
5
+ class Component(Struct):
6
+ """
7
+ Component classes are structural in nature.
8
+ The lifecycle of a component tree is as follows:
9
+ - The root component and fields of component type are constructed
10
+ - The 'init_down' method is invoked in a depth-first manner
11
+ - The 'init_up' method is invoked
12
+ """
13
+
14
+ def build(self): pass
15
+
@@ -0,0 +1,302 @@
1
+ '''
2
+ Created on Mar 19, 2022
3
+
4
+ @author: mballance
5
+ '''
6
+ import dataclasses
7
+ import dataclasses as dc
8
+ from typing import Any, Callable, Dict, Self, TypeVar
9
+ # from vsc_dataclasses.decorators import *
10
+ # from .impl.action_decorator_impl import ActionDecoratorImpl
11
+ # from .impl.exec_decorator_impl import ExecDecoratorImpl
12
+ # from .impl.exec_kind_e import ExecKindE
13
+ # from .impl.extend_kind_e import ExtendKindE
14
+ # from .impl.extend_decorator_impl import ExtendDecoratorImpl
15
+ # from .impl.extend_action_decorator_impl import ExtendActionDecoratorImpl
16
+ # from .impl.extend_component_decorator_impl import ExtendComponentDecoratorImpl
17
+ # from .impl.fn_decorator_impl import FnDecoratorImpl
18
+ # from .impl.struct_decorator_impl import StructDecoratorImpl
19
+ # from .impl.struct_kind_e import StructKindE
20
+ # from .impl.component_decorator_impl import ComponentDecoratorImpl
21
+ # from .impl.activity_decorator_impl import ActivityDecoratorImpl
22
+ # from .impl.type_kind_e import TypeKindE
23
+ from .annotation import Annotation, AnnotationSync
24
+ from .ports import Input, Output
25
+ from .clock import Clock
26
+
27
+ def dataclass(cls, **kwargs):
28
+ return dc.dataclass(cls, **kwargs)
29
+
30
+ def bundle():
31
+ return dc.field()
32
+
33
+ def mirror():
34
+ return dc.field()
35
+
36
+ class BitLiteral(int):
37
+ width : int = 1
38
+ def __getitem__(self, v) -> 'BitLiteral':
39
+ return self
40
+ pass
41
+ pass
42
+
43
+ def bit(t : int) -> BitLiteral:
44
+ return BitLiteral(t)
45
+
46
+ def val(t : int) -> int:
47
+ return t
48
+
49
+ def always(instr : BitLiteral):
50
+ match instr[0:1]:
51
+ case bit(0):
52
+ match instr[13:15]:
53
+ case bit(0):
54
+ pass
55
+ case bit(2):
56
+ pass
57
+ # unique case (instr_i[1:0])
58
+ # // C0
59
+ # 2'b00: begin
60
+ # unique case (instr_i[15:13])
61
+ # 3'b000: begin
62
+ # // c.addi4spn -> addi rd', x2, imm
63
+ # instr_o = {2'b0, instr_i[10:7], instr_i[12:11], instr_i[5],
64
+ # instr_i[6], 2'b00, 5'h02, 3'b000, 2'b01, instr_i[4:2], {OPCODE_OP_IMM}};
65
+ # if (instr_i[12:5] == 8'b0) illegal_instr_o = 1'b1;
66
+ # end
67
+
68
+ # 3'b010: begin
69
+ # // c.lw -> lw rd', imm(rs1')
70
+ # instr_o = {5'b0, instr_i[5], instr_i[12:10], instr_i[6],
71
+ # 2'b00, 2'b01, instr_i[9:7], 3'b010, 2'b01, instr_i[4:2], {OPCODE_LOAD}};
72
+ # end
73
+
74
+ # 3'b110: begin
75
+ # // c.sw -> sw rs2', imm(rs1')
76
+ # instr_o = {5'b0, instr_i[5], instr_i[12], 2'b01, instr_i[4:2],
77
+ # 2'b01, instr_i[9:7], 3'b010, instr_i[11:10], instr_i[6],
78
+ # 2'b00, {OPCODE_STORE}};
79
+ # end
80
+
81
+ # 3'b001,
82
+ # 3'b011,
83
+ # 3'b100,
84
+ # 3'b101,
85
+ # 3'b111: begin
86
+ # illegal_instr_o = 1'b1;
87
+ # end
88
+
89
+ # default: begin
90
+ # illegal_instr_o = 1'b1;
91
+ # end
92
+ # endcase
93
+
94
+ a = bit(20)[3:4]
95
+
96
+ SelfT = TypeVar('SelfT')
97
+
98
+ class bind[T](object):
99
+ def __init__(self, c : Callable[[T],Dict[Any,Any]]):
100
+ self._c = c
101
+ def __call__(self, s) -> Dict[Any,Any]:
102
+ return self._c(s)
103
+
104
+ #a = bind2(lambda s:{s.}, selfT=Self)
105
+
106
+ def field(rand=False, bind : Callable[[object],Dict[Any,Any]] = None):
107
+ pass
108
+
109
+ # @staticmethod
110
+ # def __call__(rand=False, bind : Callable[[T],Dict[Any,Any]] = None):
111
+ # pass
112
+
113
+ # """
114
+ # Marks a plain data field
115
+ # - rand -- Marks the field as being randomizable
116
+ # -
117
+ # """
118
+ # # TODO:
119
+ # return dc.field()
120
+
121
+ def input(*args, **kwargs):
122
+ return dataclasses.field(default_factory=Input)
123
+
124
+ def output(*args, **kwargs):
125
+ return dc.field(default_factory=Output)
126
+
127
+ def lock(*args, **kwargs):
128
+ return dc.field(default_factory=Lock)
129
+
130
+ def share(*args, **kwargs):
131
+ return dc.field(default_factory=Share)
132
+
133
+ def port():
134
+ return dc.field()
135
+
136
+ def export(*args, bind=None, **kwargs):
137
+ return dc.field(*args, **kwargs)
138
+
139
+ def process(T):
140
+ return T
141
+
142
+ def reg(offset=0):
143
+ return dc.field()
144
+ pass
145
+
146
+ def const(**kwargs):
147
+ return dc.field()
148
+
149
+ def sync(*args, clock=None, reset=None):
150
+ # TODO: handle two forms
151
+ if len(args) == 0:
152
+ def __call__(T):
153
+ Annotation.apply(T, AnnotationSync(clock=clock, reset=reset))
154
+ return T
155
+ return __call__
156
+ else:
157
+ Annotation.apply(args[0], AnnotationSync(clock=clock, reset=reset))
158
+ return args[0]
159
+
160
+ # def action(*args, **kwargs):
161
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
162
+ # # No-argument form
163
+ # return ActionDecoratorImpl([], {})(args[0])
164
+ # else:
165
+ # # Argument form
166
+ # return ActionDecoratorImpl(args, kwargs)
167
+
168
+ # def activity(*args, **kwargs):
169
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
170
+ # # No-argument form
171
+ # return ActivityDecoratorImpl([], {})(args[0])
172
+ # else:
173
+ # return ActivityDecoratorImpl(args, kwargs)
174
+
175
+ # def component(*args, **kwargs):
176
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
177
+ # # No-argument form
178
+ # return ComponentDecoratorImpl([], {})(args[0])
179
+ # else:
180
+ # return ComponentDecoratorImpl(args, kwargs)
181
+
182
+ def constraint(T):
183
+ setattr(T, "__constraint__", True)
184
+ return T
185
+
186
+ # def constraint(*args, **kwargs):
187
+ # # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
188
+ # # # No-argument form
189
+ # # return ConstraintDecoratorImpl({})(args[0])
190
+ # # else:
191
+ # # return ConstraintDecoratorImpl(kwargs)
192
+
193
+ # def buffer(*args, **kwargs):
194
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
195
+ # # No-argument form
196
+ # return StructDecoratorImpl(StructKindE.Buffer, [], {})(args[0])
197
+ # else:
198
+ # return ActionDecoratorImpl(StructKindE.Buffer, args, kwargs)
199
+
200
+ # def resource(*args, **kwargs):
201
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
202
+ # # No-argument form
203
+ # return StructDecoratorImpl(StructKindE.Resource, [], {})(args[0])
204
+ # else:
205
+ # return StructDecoratorImpl(StructKindE.Resource, [], kwargs)
206
+
207
+ # def state(*args, **kwargs):
208
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
209
+ # # No-argument form
210
+ # return StructDecoratorImpl(StructKindE.State, {})(args[0])
211
+ # else:
212
+ # return ActionDecoratorImpl(StructKindE.State, kwargs)
213
+
214
+ # def stream(*args, **kwargs):
215
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
216
+ # # No-argument form
217
+ # return StructDecoratorImpl(StructKindE.Stream, {})(args[0])
218
+ # else:
219
+ # return ActionDecoratorImpl(StructKindE.Stream, kwargs)
220
+
221
+ # def struct(*args, **kwargs):
222
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
223
+ # # No-argument form
224
+ # return StructDecoratorImpl(StructKindE.Struct, [], {})(args[0])
225
+ # else:
226
+ # return ActionDecoratorImpl(StructKindE.Struct, args, kwargs)
227
+
228
+ # class exec(object):
229
+ # @staticmethod
230
+ # def body(*args, **kwargs):
231
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
232
+ # # No-argument form
233
+ # return ExecDecoratorImpl(ExecKindE.Body, [], {})(args[0])
234
+ # else:
235
+ # return ExecDecoratorImpl(ExecKindE.Body, args, kwargs)
236
+
237
+ # @staticmethod
238
+ # def init_down(*args, **kwargs):
239
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
240
+ # # No-argument form
241
+ # return ExecDecoratorImpl(ExecKindE.InitDown, [], {})(args[0])
242
+ # else:
243
+ # return ExecDecoratorImpl(ExecKindE.InitDown, args, kwargs)
244
+
245
+ # @staticmethod
246
+ # def init_up(*args, **kwargs):
247
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
248
+ # # No-argument form
249
+ # return ExecDecoratorImpl(ExecKindE.InitUp, [], {})(args[0])
250
+ # else:
251
+ # return ExecDecoratorImpl(ExecKindE.InitUp, args, kwargs)
252
+
253
+ # @staticmethod
254
+ # def pre_solve(*args, **kwargs):
255
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
256
+ # # No-argument form
257
+ # return ExecDecoratorImpl(ExecKindE.PreSolve, [], {})(args[0])
258
+ # else:
259
+ # return ExecDecoratorImpl(ExecKindE.PreSolve, args, kwargs)
260
+
261
+ # @staticmethod
262
+ # def post_solve(*args, **kwargs):
263
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
264
+ # # No-argument form
265
+ # return ExecDecoratorImpl(ExecKindE.PostSolve, [], {})(args[0])
266
+ # else:
267
+ # return ExecDecoratorImpl(ExecKindE.PostSolve, args, kwargs)
268
+
269
+ # class extend(object):
270
+ # @staticmethod
271
+ # def action(target, *args, **kwargs):
272
+ # return ExtendActionDecoratorImpl(target, args, kwargs)
273
+
274
+ # @staticmethod
275
+ # def component(target, *args, **kwargs):
276
+ # return ExtendComponentDecoratorImpl(target, args, kwargs)
277
+
278
+ # class extern(object):
279
+
280
+ # # TODO:
281
+ # @staticmethod
282
+ # def action(*args, **kwargs):
283
+ # raise NotImplementedError("extern.action not implemented")
284
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
285
+ # # No-argument form
286
+ # return ExecDecoratorImpl(ExecKindE.PreSolve, {})(args[0])
287
+ # else:
288
+ # return ExecDecoratorImpl(ExecKindE.PreSolve, kwargs)
289
+
290
+ # def fn(*args, **kwargs):
291
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
292
+ # # No-argument form
293
+ # return FnDecoratorImpl(False, {})(args[0])
294
+ # else:
295
+ # return FnDecoratorImpl(False, kwargs)
296
+
297
+ # def import_fn(*args, **kwargs):
298
+ # if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
299
+ # # No-argument form
300
+ # return FnDecoratorImpl(True, {})(args[0])
301
+ # else:
302
+ # return FnDecoratorImpl(True, kwargs)
@@ -0,0 +1,22 @@
1
+ import abc
2
+ import dataclasses as dc
3
+ from typing import List
4
+
5
+ class DependencyProvider(abc.ABC): pass
6
+
7
+ class Pool[T](DependencyProvider): pass
8
+
9
+ class TrackingDependencyProvider[T](DependencyProvider):
10
+ """
11
+ Dependency provider that tracks its dependencies.
12
+ This is typically used by a component that must use
13
+ dependency information to properly build itself.
14
+ """
15
+
16
+ @abc.abstractmethod
17
+ def dependents(self) -> List[T]:
18
+ """
19
+ List of dependencies bound to this provider
20
+ """
21
+ pass
22
+
@@ -0,0 +1,61 @@
1
+ import dataclasses as dc
2
+ from typing import ClassVar, Dict, Generic, Type
3
+ from abc import abstractmethod
4
+
5
+
6
+ class Port[T]():
7
+
8
+ @abstractmethod
9
+ def __call__(self) -> T:
10
+ pass
11
+
12
+ # # Bundle is a collection of ports/exports
13
+ # class WishboneI():
14
+ # valid : Output[bool]
15
+ # ready : Input[bool]
16
+ # pass
17
+
18
+ # class ReverseT(type):
19
+ # def __new__(cls, name, bases, attrs):
20
+ # return super().__new__(cls, name, bases, attrs)
21
+
22
+ # def __getitem__(self, T : type):
23
+ # pass
24
+
25
+
26
+ # class Reverse[T](metaclass=ReverseT):
27
+
28
+ # def __class_getitem__(cls):
29
+ # pass
30
+
31
+ # pass
32
+
33
+ # WishboneIM=Reverse[WishboneI]
34
+
35
+ # class Api[T](ABC):
36
+
37
+ # @abstractmethod
38
+ # def put(self, val : T):
39
+ # pass
40
+
41
+ # @abstractmethod
42
+ # def get(self) -> T:
43
+ # pass
44
+
45
+ # class MyModule:
46
+ # init_o : Port[WishboneI]
47
+ # dat_o : Port[Api[int]]
48
+
49
+ # def doit(self):
50
+ # self.init_o().ready = 1
51
+ # if self.init_o().valid:
52
+ # pass
53
+
54
+ # a = self.dat_o().get()
55
+ # self.dat_o().put(5)
56
+
57
+ class Input(object):
58
+ pass
59
+
60
+ class Output(object):
61
+ pass
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,3 @@
1
+
2
+ class Reset(object):
3
+ pass
@@ -0,0 +1,42 @@
1
+ import abc
2
+ from typing import Dict, Optional, Type
3
+ from .decorators import dataclass
4
+
5
+ @dataclass
6
+ class StructPacked(object):
7
+ """
8
+ StructPacked types are fixed-size data structures.
9
+ Fields may only be of a fixed size.
10
+
11
+ Valid sub-regions
12
+ - constraint
13
+ - pre_solve / post_solve
14
+ """
15
+ pass
16
+
17
+ @dataclass
18
+ class Struct(object):
19
+ """
20
+ Struct types are data structures that may contain
21
+ variable-size fields.
22
+
23
+ Valid sub-regions
24
+ - constraint
25
+ - pre_solve / post_solve
26
+ - method
27
+ """
28
+
29
+ # @abc.abstractmethod
30
+ # def bind[T](self, t : T):
31
+ # t : Type[T],
32
+ # init : Optional[Dict]=None,
33
+ # bind : Optional[Dict]=None) -> T:
34
+ # """
35
+ # Public API
36
+ # Applies service Creates a new instance of the specified class.
37
+ # - Resolves service claims relative to the context
38
+ # object and any bind specifications.
39
+ # """
40
+ # pass
41
+
42
+ pass
@@ -0,0 +1,27 @@
1
+ import abc
2
+ from .component import Component
3
+ from .decorators import dataclass, input
4
+ from .bit import Bit
5
+
6
+ @dataclass
7
+ class TimeBase(object):
8
+ """
9
+ TimeBase exposes the notion of design time
10
+ """
11
+
12
+ @abc.abstractmethod
13
+ async def wait(self, amt : float, units):
14
+ """Scales the time to the timebase and waits"""
15
+ pass
16
+
17
+ @abc.abstractmethod
18
+ def wait_ev(self, amt : float, units):
19
+ """Scales the time to the timebase and returns an event"""
20
+ pass
21
+
22
+ pass
23
+
24
+ class TimeBaseSignal(TimeBase,Component):
25
+ clock : Bit = input()
26
+ reset : Bit = input()
27
+
@@ -0,0 +1,12 @@
1
+ import abc
2
+ import dataclasses as dc
3
+ from typing import Callable, Dict, Awaitable, Type, dataclass_transform
4
+
5
+ @dc.dataclass
6
+ class IPut[T]():
7
+ put : Callable[[Type[T]], Awaitable] = dc.field()
8
+
9
+ @dc.dataclass
10
+ class IGet[T]():
11
+ get : Callable[[], Awaitable[T]] = dc.field()
12
+
File without changes
@@ -0,0 +1,197 @@
1
+ #****************************************************************************
2
+ #* extract_cpp_embedded_dsl.py
3
+ #*
4
+ #* Copyright 2022 Matthew Ballance and Contributors
5
+ #*
6
+ #* Licensed under the Apache License, Version 2.0 (the "License"); you may
7
+ #* not use this file except in compliance with the License.
8
+ #* You may obtain a copy of the License at:
9
+ #*
10
+ #* http://www.apache.org/licenses/LICENSE-2.0
11
+ #*
12
+ #* Unless required by applicable law or agreed to in writing, software
13
+ #* distributed under the License is distributed on an "AS IS" BASIS,
14
+ #* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ #* See the License for the specific language governing permissions and
16
+ #* limitations under the License.
17
+ #*
18
+ #* Created on:
19
+ #* Author:
20
+ #*
21
+ #****************************************************************************
22
+ from typing import List
23
+
24
+ #
25
+ #
26
+ # ZSP_DATACLASSES(TestSuite_testname, RootComp, RootAction, R"(
27
+ # @vdc.randclass
28
+ # class MyC(object):
29
+ # a : vdc.rand_uint32_t
30
+ # )")
31
+ #
32
+ #
33
+
34
+ class DSLContent(object):
35
+ def __init__(self,
36
+ name,
37
+ root_comp,
38
+ root_action,
39
+ content):
40
+ self.name = name
41
+ self.root_comp = root_comp
42
+ self.root_action = root_action
43
+ self.content = content
44
+
45
+ class ExtractCppEmbeddedDSL(object):
46
+
47
+ def __init__(self,
48
+ file_or_fp,
49
+ name=None,
50
+ macro_name="ZSP_DATACLASSES"):
51
+ self._macro_name = macro_name
52
+ if hasattr(file_or_fp, "read"):
53
+ # This is a stream-like object
54
+ self._fp = file_or_fp
55
+ if name is None:
56
+ self._name = self._fp.name()
57
+ else:
58
+ self._fp = open(file_or_fp, "r")
59
+ self._name = file_or_fp
60
+
61
+ self._lineno = 0
62
+ self._unget_ch = None
63
+ self._last_ch = None
64
+ self._buffer = ""
65
+ self._buffer_i = 0
66
+
67
+ def extract(self) -> List[DSLContent]:
68
+ ret = []
69
+
70
+ while self.find_macro():
71
+
72
+ lineno = self._lineno
73
+ while True:
74
+ ch = self.getch()
75
+
76
+ if ch is None or ch == '(':
77
+ break
78
+
79
+ if ch is None:
80
+ raise Exception("Failed to parse embedded DSL @ %s:%d" % (self._name, self._lineno))
81
+
82
+ # Now, collect the complete content of the macro
83
+ content = ""
84
+ count_b = 1
85
+ while count_b > 0:
86
+ ch = self.getch()
87
+
88
+ if ch is None:
89
+ break
90
+ content += ch
91
+
92
+ if ch == '(':
93
+ count_b += 1
94
+ elif ch == ')':
95
+ count_b -= 1
96
+
97
+ if count_b > 0:
98
+ raise Exception("Unbalanced parens")
99
+ content = content[:-2]
100
+
101
+ # We now have text from a macro invocation
102
+ start = 0
103
+ count_b = 0
104
+ params = []
105
+
106
+ for i in range(len(content)):
107
+ if content[i] == "," and count_b == 0:
108
+ params.append(content[start:i].strip())
109
+ start = i+1
110
+ elif content[i] == '(':
111
+ count_b += 1
112
+ elif content[i] == ')':
113
+ count_b -= 1
114
+
115
+ if count_b != 0:
116
+ raise Exception("Unbalanced parens while tokenizing")
117
+
118
+ if start < len(content):
119
+ params.append(content[start:].strip())
120
+
121
+ if len(params) != 4:
122
+ raise Exception("Expected 3 params; received %d" % len(params))
123
+
124
+ if params[-1].startswith('R"('):
125
+ params[-1] = params[-1][3:-2]
126
+
127
+ content = params[-1].split("\n")
128
+ min_ws = 10000
129
+
130
+ for l in content:
131
+ l_strip = l.strip()
132
+ if l_strip != "":
133
+ ws_l = len(l) - len(l_strip)
134
+ if ws_l < min_ws:
135
+ min_ws = ws_l
136
+
137
+ for i in range(len(content)):
138
+ content[i] = content[i][min_ws:]
139
+
140
+ vsc_content = "\n".join(content)
141
+
142
+ root_comp = params[1]
143
+ root_action = params[2]
144
+
145
+ info = DSLContent(params[0], root_comp, root_action, vsc_content)
146
+ ret.append(info)
147
+
148
+ self._fp.close()
149
+ return ret
150
+
151
+ def find_macro(self):
152
+
153
+ while True:
154
+ line = self._fp.readline()
155
+ self._lineno += 1
156
+
157
+ if line == "":
158
+ break
159
+
160
+ idx = line.find(self._macro_name)
161
+
162
+ if idx >= 0:
163
+ self._buffer = line
164
+ self._buffer_i = idx + len(self._macro_name)
165
+ return True
166
+
167
+ return False
168
+
169
+ def getch(self):
170
+ if self._buffer is None:
171
+ return None
172
+
173
+ if self._buffer_i >= len(self._buffer):
174
+ try:
175
+ self._buffer = self._fp.readline()
176
+ self._buffer_i = 0
177
+ self._lineno += 1
178
+ if self._buffer == "":
179
+ self._buffer = None
180
+ return None
181
+ except Exception:
182
+ self._buffer = None
183
+ return None
184
+
185
+ ret = self._buffer[self._buffer_i]
186
+ self._buffer_i += 1
187
+ return ret
188
+
189
+ def ungetch(self, ch):
190
+ if self._buffer is None:
191
+ self._buffer = ch
192
+ elif self._buffer_i > 0:
193
+ self._buffer_i -= 1
194
+ self._buffer[self._buffer_i] = ch
195
+ else:
196
+ self._buffer.insert(0, ch)
197
+
@@ -0,0 +1,102 @@
1
+ #****************************************************************************
2
+ #* __main__.py
3
+ #*
4
+ #* zsp_dataclasses.util.gen_cpp_dt_defs
5
+ #*
6
+ #* Copyright 2022 Matthew Ballance and Contributors
7
+ #*
8
+ #* Licensed under the Apache License, Version 2.0 (the "License"); you may
9
+ #* not use this file except in compliance with the License.
10
+ #* You may obtain a copy of the License at:
11
+ #*
12
+ #* http://www.apache.org/licenses/LICENSE-2.0
13
+ #*
14
+ #* Unless required by applicable law or agreed to in writing, software
15
+ #* distributed under the License is distributed on an "AS IS" BASIS,
16
+ #* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ #* See the License for the specific language governing permissions and
18
+ #* limitations under the License.
19
+ #*
20
+ #* Created on:
21
+ #* Author:
22
+ #*
23
+ #****************************************************************************
24
+
25
+ import argparse
26
+ import os
27
+ import zuspec as zdc
28
+ from zuspec.impl.ctor import Ctor
29
+ from zuspec.impl.pyctxt.context import Context
30
+ from zuspec.impl.generators.zsp_data_model_cpp_gen import ZspDataModelCppGen
31
+ from ..extract_cpp_embedded_dsl import ExtractCppEmbeddedDSL
32
+
33
+ def get_parser():
34
+ parser = argparse.ArgumentParser()
35
+ parser.add_argument("-o","--outdir", default="zspdefs",
36
+ help="Specifies the output directory")
37
+ parser.add_argument("-d", "--depfile",
38
+ help="Specifies a dependency file")
39
+ parser.add_argument("files", nargs='+')
40
+
41
+ return parser
42
+
43
+ def main():
44
+ parser = get_parser()
45
+ args = parser.parse_args()
46
+
47
+ deps_ts = None
48
+ if args.depfile is not None and os.path.isfile(args.depfile):
49
+ deps_ts = os.path.getmtime(args.depfile)
50
+
51
+ fragment_m = {}
52
+ for file in args.files:
53
+ print("Process %s" % file)
54
+ if deps_ts is not None:
55
+ file_ts = os.path.getmtime(file)
56
+ if file_ts <= deps_ts:
57
+ print("Skip due to deps")
58
+ continue
59
+
60
+ fragments = ExtractCppEmbeddedDSL(file).extract()
61
+ print("fragments: %s" % str(fragments))
62
+
63
+ for f in fragments:
64
+ if f.name in fragment_m.keys():
65
+ raise Exception("Duplicate fragment-name %s" % f.name)
66
+ fragment_m[f.name] = f
67
+
68
+ if not os.path.isdir(args.outdir):
69
+ os.makedirs(args.outdir, exist_ok=True)
70
+
71
+ for fn in fragment_m.keys():
72
+ Ctor.init(Context())
73
+
74
+ print("--> Process Fragment %s" % fn)
75
+ _globals = globals().copy()
76
+ exec(fragment_m[fn].content, _globals)
77
+ print("<-- Process Fragment %s" % fn)
78
+
79
+ Ctor.inst().elab()
80
+
81
+ header_path = os.path.join(args.outdir, "%s.h" % fn)
82
+ root_comp = Ctor.inst().ctxt().findDataTypeComponent(fragment_m[fn].root_comp)
83
+ if root_comp is None:
84
+ raise Exception("Failed to find root component %s" % fragment_m[fn].root_comp)
85
+ root_action = Ctor.inst().ctxt().findDataTypeAction(fragment_m[fn].root_action)
86
+ if root_action is None:
87
+ raise Exception("Failed to find root action %s" % fragment_m[fn].root_action)
88
+ gen = ZspDataModelCppGen()
89
+ gen._ctxt = "m_ctxt"
90
+ with open(header_path, "w") as fp:
91
+ fp.write(gen.generate(
92
+ root_comp,
93
+ root_action,
94
+ Ctor.inst().ctxt().getDataTypeFunctions()))
95
+
96
+ if args.depfile is not None:
97
+ with open(args.depfile, "w") as fp:
98
+ fp.write("\n")
99
+
100
+ if __name__ == "__main__":
101
+ main()
102
+
@@ -0,0 +1 @@
1
+ # Package marker for zuspec.impl
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: zuspec-dataclasses
3
+ Version: 0.0.1
4
+ License-File: LICENSE
5
+ Dynamic: license-file
@@ -0,0 +1,28 @@
1
+ zuspec/dataclasses/__init__.py,sha256=N7A7kcH2MWv11kqVA-s0SyKnWBAKD6ijQXJOrzfRyf8,452
2
+ zuspec/dataclasses/__version__.py,sha256=hYXCtEyKiPU-TrubK6Unu2SK0ieIr0qyB5gzlj9a-2Y,71
3
+ zuspec/dataclasses/action.py,sha256=z7aMc6e_k_-NCzYDm8K1ymEPfcGeyqlO79of0Gucack,570
4
+ zuspec/dataclasses/addr_reg.py,sha256=QmxPQ8lq1255ZfOjQRGFGWGGwK-pSpPFJ4mdzJlj8dw,1111
5
+ zuspec/dataclasses/annotation.py,sha256=M41iS93Oi8M-ER_ZIBI8CIWJ1bvEMI0nHa-RxbmWJUs,328
6
+ zuspec/dataclasses/bit.py,sha256=Zxm3F04GcfuJczmwCrMuvpcBCunWMZQFffB4JvNterI,614
7
+ zuspec/dataclasses/bundle.py,sha256=6fqjfoTS_-_izl4FlPFgurfOg3tnj_1fmEdSa1FF4C0,781
8
+ zuspec/dataclasses/clock.py,sha256=pM0rO-3bp0SGJccxtU-17vIcF9EaSlqD-q1_9O0of1o,30
9
+ zuspec/dataclasses/component.py,sha256=vzPCmLdAgm-x46Or18RtBYRClVUkbqIZ1yqp1nu5sL4,416
10
+ zuspec/dataclasses/decorators.py,sha256=fSJpsTbahzQdtFtlVhDFSHFFuYmiRxg_3S_W1DpjLDY,9797
11
+ zuspec/dataclasses/dependency.py,sha256=kGxdFqKlviUP7qmvN-FbnXIiqCPdgRRel83feuu8OoU,532
12
+ zuspec/dataclasses/ports.py,sha256=3pbBwdBzDMAJTZ15Qf6sSXB-XOH5cJ-G5H8kQa5JurQ,1106
13
+ zuspec/dataclasses/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
14
+ zuspec/dataclasses/reset.py,sha256=DV8tiKq_k-AGUNBbpJCJFx_EEfA07UgUJK2veYli0b0,30
15
+ zuspec/dataclasses/struct.py,sha256=vId0487ZJmhnTbTg421B-iN9PtxNexCv9DMqRO8RXBU,973
16
+ zuspec/dataclasses/timebase.py,sha256=rjEiGB2lNPMTewE-Z4iX-CHnbx1QVTUbtwEXnKMkesI,599
17
+ zuspec/dataclasses/tlm.py,sha256=TjODFwvombQR7AVVI7HlW37MEm22Zu9JdVYpOCU4_Vg,277
18
+ zuspec/dataclasses/api/__init__.py,sha256=HfJhJ_B1RJSpJn5NmWzEK3l2IruubiEKd3xwLDuED6Q,30
19
+ zuspec/dataclasses/api/visitor.py,sha256=8-5er0GxAWnvxhDmiR_OBn2iMxtymtol5qM09ucKdLI,1780
20
+ zuspec/dataclasses/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ zuspec/dataclasses/util/extract_cpp_embedded_dsl.py,sha256=SyMMLumZD6fsubj40hyekYzWyrcoUGTijJH3NmK1ihY,5630
22
+ zuspec/dataclasses/util/gen_cpp_dt_defs/__main__.py,sha256=t3CnHJKcN_N33sxCsDH-R36ghCcQ7xjMcjUrzUT2SGM,3447
23
+ zuspec/impl/__init__.py,sha256=GZWCeBPdVzLR0RNPkmXNXPgdS-2vg5dMC1goTYJs3yI,33
24
+ zuspec_dataclasses-0.0.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ zuspec_dataclasses-0.0.1.dist-info/METADATA,sha256=HFi2cIVpagjnV1Dcq5GW7aM9cF8MgMv3P9c4WAVdESE,106
26
+ zuspec_dataclasses-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ zuspec_dataclasses-0.0.1.dist-info/top_level.txt,sha256=3WM_V5g1RvpI4_z1TPY_AmroKhWIp6QJo4Vz5Tqbgak,7
28
+ zuspec_dataclasses-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ zuspec