forked from Vlsir/Vlsir
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcircuit.proto
More file actions
156 lines (142 loc) · 3.66 KB
/
circuit.proto
File metadata and controls
156 lines (142 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//!
//! # vlsir Circuit Schema
//!
syntax = "proto3";
package vlsir.circuit;
import "utils.proto";
// # Package
// A Collection of Modules and ExternalModules
message Package {
// Domain Name
string domain = 1;
// `Module` Definitions
repeated Module modules = 2;
// `ExternalModule` interfaces used by `modules`, and available externally
repeated ExternalModule ext_modules = 3;
// Description
string desc = 10;
}
// # Port
// An externally-visible `Signal` with a `Direction`.
message Port {
enum Direction {
INPUT = 0;
OUTPUT = 1;
INOUT = 2;
NONE = 3;
}
string signal = 1; // Reference to `Signal` by name
Direction direction = 2; // Port direction
}
// # Signal
// A named connection element, potentially with non-unit `width`.
message Signal {
// Signal Name
string name = 1;
// Bus Width
int64 width = 2;
}
// # Signal Slice
// Reference to a subset of bits of `signal`.
// Indices `top` and `bot` are both inclusive, similar to popular HDLs.
message Slice {
// Parent Signal Name
string signal = 1;
// Top Index
int64 top = 2;
// Bottom Index
int64 bot = 3;
}
// Signal Concatenation
// FIXME: documentation of ordering, MSB-LSB
message Concat {
repeated ConnectionTarget parts = 1;
}
// # ConnectionTarget Union
// Enumerates all types that can be
// (a) Connected to Ports, and
// (b) Concatenated
message ConnectionTarget {
oneof stype {
string sig = 1; // Reference to `Signal` (name) `sig`
Slice slice = 2; // Slice into signals
Concat concat = 3; // Concatenation of signals
}
}
// # Port Connection
// Pairing between an Instance port (name) and a parent-module ConnectionTarget.
message Connection {
string portname = 1;
ConnectionTarget target = 2;
}
// Module Instance
message Instance {
// Instance Name
string name = 1;
// Reference to Module instantiated
vlsir.utils.Reference module = 2;
// Parameter Values
repeated vlsir.utils.Param parameters = 3;
// Port `Connection`s
repeated Connection connections = 4;
}
// Module - the primary unit of hardware re-use
message Module {
// Module Name
string name = 1;
// Port List, referring to elements of `signals` by name
// Ordered as they will be in order-sensitive formats, such as typical netlist formats.
repeated Port ports = 2;
// Signal Definitions, including externally-facing `Port` signals
repeated Signal signals = 3;
// Module Instances
repeated Instance instances = 4;
// Parameters
repeated vlsir.utils.Param parameters = 5;
// Literal Contents, e.g. in downstream EDA formats
repeated string literals = 6;
}
// Spice Type, used to identify what a component is in spice
enum SpiceType {
// The default value is implicitly SUBCKT
SUBCKT = 0;
RESISTOR = 1;
CAPACITOR = 2;
INDUCTOR = 3;
MOS = 4;
DIODE = 5;
BIPOLAR = 6;
VSOURCE = 7;
ISOURCE = 8;
VCVS = 9;
VCCS = 10;
CCCS = 11;
CCVS = 12;
TLINE = 13;
}
// # Externally Defined Module
// Primarily for sake of port-ordering, for translation with connect-by-position
// formats.
message ExternalModule {
// Qualified External Module Name
vlsir.utils.QualifiedName name = 1;
// Description
string desc = 2;
// Port Definitions
// Ordered as they will be in order-sensitive formats, such as typical netlist formats.
repeated Port ports = 3;
// Signal Definitions, limited to those used by external-facing ports.
repeated Signal signals = 4;
// Params
repeated vlsir.utils.Param parameters = 5;
// Spice Type, SUBCKT by default
SpiceType spicetype = 6;
}
// # Interface
// Defines the logical IO of a `Module`
message Interface {
// Cell Name
string name = 1;
// Port List
repeated Port ports = 10;
}