Skip to content

Commit 9904509

Browse files
committed
engine: define arrays
1 parent a104920 commit 9904509

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

src/simlin-engine/src/bytecode.rs

+6
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,17 @@ pub struct ModuleDeclaration {
8080
pub(crate) off: usize, // offset within the parent module
8181
}
8282

83+
#[derive(Clone, Debug)]
84+
pub struct ArrayDefinition {
85+
pub(crate) dimensions: Vec<usize>,
86+
}
87+
8388
// these are things that will be shared across bytecode runlists
8489
#[derive(Clone, Debug)]
8590
pub struct ByteCodeContext {
8691
pub(crate) graphical_functions: Vec<Vec<(f64, f64)>>,
8792
pub(crate) modules: Vec<ModuleDeclaration>,
93+
pub(crate) arrays: Vec<ArrayDefinition>,
8894
}
8995

9096
#[derive(Clone, Debug, Default)]

src/simlin-engine/src/compiler.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,7 @@ impl<'module> Compiler<'module> {
17451745
context: Rc::new(ByteCodeContext {
17461746
graphical_functions: self.graphical_functions,
17471747
modules: self.module_decls,
1748+
arrays: vec![],
17481749
}),
17491750
compiled_initials,
17501751
compiled_flows,

src/simlin-engine/src/project_io.proto

+26
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,29 @@ message Project {
299299
repeated Model models = 3;
300300
Source source = 5;
301301
};
302+
303+
// the following are for serializing and deserializing the bytecode/data sent to the engine for a model
304+
305+
enum BuiltinId {
306+
UNSPECIFIED = 0;
307+
Abs = 1;
308+
Arccos = 2;
309+
Arcsin = 3;
310+
Arctan = 4;
311+
Cos = 5;
312+
Exp = 6;
313+
Inf = 7;
314+
Int = 8;
315+
Ln = 9;
316+
Log10 = 10;
317+
Max = 11;
318+
Min = 12;
319+
Pi = 13;
320+
Pulse = 14;
321+
Ramp = 15;
322+
SafeDiv = 16;
323+
Sin = 17;
324+
Sqrt = 18;
325+
Step = 19;
326+
Tan = 20;
327+
};

0 commit comments

Comments
 (0)