-
Notifications
You must be signed in to change notification settings - Fork 1
/
Simulator.capnp
81 lines (62 loc) · 1.73 KB
/
Simulator.capnp
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
# SPDX-FileCopyrightText: 2022 Pepijn de Vos
#
# SPDX-License-Identifier: MPL-2.0
@0x8c03f73b3ceae3de;
using Cxx = import "/capnp/c++.capnp";
$Cxx.namespace("Sim");
interface Simulator(Cmd) {
loadFiles @0 (files :List(File)) -> (commands :Cmd);
loadPath @1 (file :Text) -> (commands :Cmd);
}
interface Run {
run @0 (vectors :List(Text)) -> (result :Result);
}
interface Tran {
tran @0 (step :Float64, stop :Float64, start :Float64, vectors :List(Text)) -> (result :Result);
}
interface Op {
op @0 (vectors :List(Text)) -> (result :Result);
}
interface Ac {
ac @0 (mode :AcType, num :UInt64, fstart :Float64, fstop :Float64, vectors :List(Text)) -> (result :Result);
}
interface Noise {
noise @0 (output :Text, src :Text, mode :AcType, num :UInt64, fstart :Float64, fstop :Float64, vectors :List(Text)) -> (result :Result);
}
interface Dc {
dc @0 (src :Text, vstart :Float64, vstop :Float64, vincr :Float64, vectors :List(Text)) -> (result :Result);
}
enum AcType {
lin @0;
dec @1;
oct @2;
}
interface Result {
read @0 () -> (more :Bool, data :List(Vectors), stdout :Data);
}
struct Vectors {
name @0 :Text;
scale @1 :Text;
data @2 :List(Vector);
}
struct Vector {
name @0 :Text;
data :union {
real @1 :List(Float64);
complex @2 :List(Complex);
digital @3 :List(Bool); # actually packed as 1 bit, cool
}
}
struct Complex {
real @0 :Float64;
imag @1 :Float64;
}
struct File {
name @0 :Text;
contents @1 :Data;
}
# Implementations
interface Xyce extends(Simulator(Run)) { }
interface NgspiceCommands extends(Run, Tran, Op, Dc, Ac, Noise) {}
interface Ngspice extends(Simulator(NgspiceCommands)) { }
interface Cxxrtl extends(Simulator(Run)) { }