-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathevaluation-layer.drawio
More file actions
133 lines (133 loc) · 19.3 KB
/
evaluation-layer.drawio
File metadata and controls
133 lines (133 loc) · 19.3 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
<mxfile host="Electron" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/29.3.6 Chrome/140.0.7339.249 Electron/38.8.0 Safari/537.36" version="29.3.6">
<diagram name="Evaluation Layer" id="d3">
<mxGraphModel dx="6566" dy="3069" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="4200" pageHeight="3000" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="title" parent="1" style="text;html=1;fontSize=22;fontStyle=1;align=center;verticalAlign=middle;fillColor=none;strokeColor=none;fontColor=#333333;" value="Evaluation Layer — Expression Parsing, Evaluation and Context" vertex="1">
<mxGeometry height="50" width="1400" x="800" y="10" as="geometry" />
</mxCell>
<mxCell id="leg_title" parent="1" style="text;html=1;fontSize=13;fontStyle=1;align=left;fillColor=none;strokeColor=none;" value="Legend" vertex="1">
<mxGeometry height="24" width="80" x="50" y="80" as="geometry" />
</mxCell>
<mxCell id="leg1c" parent="1" style="rounded=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" value="" vertex="1">
<mxGeometry height="18" width="18" x="50" y="110" as="geometry" />
</mxCell>
<mxCell id="leg1t" parent="1" style="text;html=1;fontSize=11;align=left;fillColor=none;strokeColor=none;" value="Context / orchestrator" vertex="1">
<mxGeometry height="18" width="160" x="76" y="110" as="geometry" />
</mxCell>
<mxCell id="leg2c" parent="1" style="rounded=1;fillColor=#d5e8d4;strokeColor=#82b366;" value="" vertex="1">
<mxGeometry height="18" width="18" x="50" y="136" as="geometry" />
</mxCell>
<mxCell id="leg2t" parent="1" style="text;html=1;fontSize=11;align=left;fillColor=none;strokeColor=none;" value="Parser / evaluator" vertex="1">
<mxGeometry height="18" width="140" x="76" y="136" as="geometry" />
</mxCell>
<mxCell id="leg3c" parent="1" style="rounded=1;fillColor=#e1d5e7;strokeColor=#9673a6;" value="" vertex="1">
<mxGeometry height="18" width="18" x="50" y="162" as="geometry" />
</mxCell>
<mxCell id="leg3t" parent="1" style="text;html=1;fontSize=11;align=left;fillColor=none;strokeColor=none;" value="Interface / bridge" vertex="1">
<mxGeometry height="18" width="140" x="76" y="162" as="geometry" />
</mxCell>
<mxCell id="leg4c" parent="1" style="rounded=1;fillColor=#fff2cc;strokeColor=#d6b656;" value="" vertex="1">
<mxGeometry height="18" width="18" x="50" y="188" as="geometry" />
</mxCell>
<mxCell id="leg4t" parent="1" style="text;html=1;fontSize=11;align=left;fillColor=none;strokeColor=none;" value="Interface definition" vertex="1">
<mxGeometry height="18" width="140" x="76" y="188" as="geometry" />
</mxCell>
<mxCell id="leg5c" parent="1" style="rounded=1;fillColor=#f8cecc;strokeColor=#b85450;dashed=1;" value="" vertex="1">
<mxGeometry height="18" width="18" x="50" y="214" as="geometry" />
</mxCell>
<mxCell id="leg5t" parent="1" style="text;html=1;fontSize=11;align=left;fillColor=none;strokeColor=none;" value="External subsystem" vertex="1">
<mxGeometry height="18" width="150" x="76" y="214" as="geometry" />
</mxCell>
<mxCell id="ev_ctx" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;strokeWidth=2;" value="<p style="margin:0;text-align:center;font-size:15px;"><b>ScvdEvalContext</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">_ctx: EvalContext<br/>_evalHost: ScvdEvalInterface<br/>_evaluator: Evaluator<br/>_integerModel: IntegerModel<br/>_memoryHost: MemoryHost<br/>_registerHost: RegisterHost<br/>_debugTarget: ScvdDebugTarget<br/>_parserInterface: ScvdExpressionParser<br/>_cancellation: ExecutionCancellation</p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">constructor() — creates all components<br/>init(session, tracker) — configureIntegerModel + debugTarget.init<br/>get executionContext(): ExecutionContext</p>" vertex="1">
<mxGeometry height="360" width="460" x="890" y="100" as="geometry" />
</mxCell>
<mxCell id="ev_iface" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#fff2cc;strokeColor=#d6b656;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;strokeWidth=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>ExecutionContext</b> <i>(interface)</i></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">memoryHost: MemoryHost<br/>registerHost: RegisterHost<br/>evalContext: EvalContext<br/>debugTarget: ScvdDebugTarget<br/>evaluator: Evaluator<br/>parser: ScvdExpressionParser<br/>cancellation: ExecutionCancellation</p>" vertex="1">
<mxGeometry height="240" width="400" x="290" y="100" as="geometry" />
</mxCell>
<mxCell id="ev_parser" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#d5e8d4;strokeColor=#82b366;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>ScvdExpressionParser</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">_parser: Parser<br/>_optimizer: ExpressionOptimizer</p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">parseExpression(expr, isPrint)<br/>Returns: ParseResult (AST + format segments)</p>" vertex="1">
<mxGeometry height="200" width="380" x="290" y="400" as="geometry" />
</mxCell>
<mxCell id="ev_evalinterface" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;strokeWidth=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>ScvdEvalInterface</b></p><p style="margin:0;text-align:center;font-size:11px;color:#666;">implements ModelHost, DataAccessHost, IntrinsicProvider</p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">_registerCache: RegisterHost<br/>_memHost: MemoryHost<br/>_debugTarget: ScvdDebugTarget<br/>_formatSpecifier: ScvdFormatSpecifier<br/>_caches: ScvdEvalInterfaceCache</p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">getSymbolRef() / getMemberRef() — model navigation<br/>readValue() / writeValue() — memory access<br/>readRegister() / writeRegister() — register access<br/>findSymbolAddress() — debug symbol lookup<br/>formatValue() — printf-style formatting<br/>resetEvalCaches() / resetPrintfCache()</p>" vertex="1">
<mxGeometry height="340" width="440" x="900" y="580" as="geometry" />
</mxCell>
<mxCell id="ev_evaluator" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#d5e8d4;strokeColor=#82b366;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>Evaluator</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">Evaluates parsed AST expressions<br/>Walks expression tree nodes<br/>Calls into ModelHost / DataAccessHost<br/>Handles arithmetic, comparisons, etc.</p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">evaluate(ast, context)<br/>resetEvalCaches()</p>" vertex="1">
<mxGeometry height="220" width="380" x="1430" y="610" as="geometry" />
</mxCell>
<mxCell id="ev_evalctx" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#d5e8d4;strokeColor=#82b366;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>EvalContext</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">Runtime context for expression evaluation<br/>Holds current scope / reference container<br/>Bridges Evaluator with EvalInterface</p>" vertex="1">
<mxGeometry height="140" width="380" x="1440" y="870" as="geometry" />
</mxCell>
<mxCell id="ev_cache" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#f5f5f5;strokeColor=#666666;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>ScvdEvalInterfaceCache</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">printfCache: Map&lt;string, string&gt;<br/>symbolRefCache: Map&lt;ScvdNode, Map&lt;string, ScvdNode&gt;&gt;<br/>memberRefCache: Map&lt;ScvdNode, Map&lt;string, ScvdNode&gt;&gt;<br/>byteWidthCache: Map&lt;ScvdNode, number&gt;<br/>memberOffsetCache: Map&lt;ScvdNode, number&gt;</p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">clearAll() / clearPrintf()</p>" vertex="1">
<mxGeometry height="230" width="440" x="900" y="970" as="geometry" />
</mxCell>
<mxCell id="ev_intmodel" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#f5f5f5;strokeColor=#666666;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>IntegerModel</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">Configures integer bit widths (32/64)<br/>Set during init() from target info</p>" vertex="1">
<mxGeometry height="120" width="340" x="1430" y="1070" as="geometry" />
</mxCell>
<mxCell id="ev_cancel" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#f5f5f5;strokeColor=#666666;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>ExecutionCancellation</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">Timeout-based cancellation token<br/>reset(timeoutMs) / isCancelled<br/>Used to abort long-running evaluations</p>" vertex="1">
<mxGeometry height="130" width="380" x="1450" y="1250" as="geometry" />
</mxCell>
<mxCell id="ev_format" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#f5f5f5;strokeColor=#666666;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>ScvdFormatSpecifier</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">Resolves format type info (kind, bits)<br/>Used by ScvdEvalInterface for printf</p>" vertex="1">
<mxGeometry height="120" width="380" x="290" y="670" as="geometry" />
</mxCell>
<mxCell id="ev_host_ifaces" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#fff2cc;strokeColor=#d6b656;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>Host Interfaces (implemented by ScvdEvalInterface)</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;"><b>ModelHost</b>: getSymbolRef(), getMemberRef(), getElementRef()<br/>— Navigate the SCVD model tree by name<br/><br/><b>DataAccessHost</b>: readValue(), writeValue(), readRegister(), writeRegister()<br/>— Read/write target memory and registers<br/><br/><b>IntrinsicProvider</b>: callIntrinsic()<br/>— Built-in functions (e.g. __size, __addr)</p>" vertex="1">
<mxGeometry height="260" width="560" x="270" y="930" as="geometry" />
</mxCell>
<mxCell id="ev_data_flow" parent="1" style="rounded=1;whiteSpace=wrap;html=1;overflow=fill;fontSize=12;fillColor=#fff2cc;strokeColor=#d6b656;verticalAlign=top;align=left;spacingLeft=4;spacingTop=2;" value="<p style="margin:0;text-align:center;font-size:13px;"><b>Data Flow During Evaluation</b></p><hr size="1"/><p style="margin:4px 8px;font-size:11px;text-align:left;">1. StatementEngine calls Evaluator.evaluate(ast, ctx)<br/>2. Evaluator walks AST, resolves symbols via ModelHost<br/>3. For data reads: Evaluator calls DataAccessHost.readValue()<br/>4. ScvdEvalInterface delegates to MemoryHost / RegisterHost<br/>5. MemoryHost reads from ValidatingCache (MemoryContainer)<br/>6. If cache miss: ScvdDebugTarget.readMemory() via DAP<br/>7. Results flow back through Evaluator to Statement<br/>8. Statement sets GUI name/value on ScvdGuiTree node</p>" vertex="1">
<mxGeometry height="240" width="540" x="290" y="1250" as="geometry" />
</mxCell>
<mxCell id="ev_ext_se" parent="1" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#f8cecc;strokeColor=#b85450;dashed=1;align=center;" value="<i>StatementEngine</i><br/>(uses ExecutionContext)" vertex="1">
<mxGeometry height="60" width="320" x="1510" y="80" as="geometry" />
</mxCell>
<mxCell id="ev_ext_data" parent="1" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#f8cecc;strokeColor=#b85450;dashed=1;align=center;" value="<i>Data Hosts (MemoryHost, RegisterHost)</i><br/>(delegated to by ScvdEvalInterface)" vertex="1">
<mxGeometry height="60" width="330" x="1510" y="180" as="geometry" />
</mxCell>
<mxCell id="ev_ext_model" parent="1" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#f8cecc;strokeColor=#b85450;dashed=1;align=center;" value="<i>SCVD Model (ScvdNode tree)</i><br/>(navigated by ModelHost methods)" vertex="1">
<mxGeometry height="60" width="330" x="1510" y="270" as="geometry" />
</mxCell>
<mxCell id="ev_ext_target" parent="1" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#f8cecc;strokeColor=#b85450;dashed=1;align=center;" value="<i>ScvdDebugTarget</i><br/>(accessed for symbol resolution)" vertex="1">
<mxGeometry height="60" width="340" x="1510" y="380" as="geometry" />
</mxCell>
<mxCell id="ee1" edge="1" parent="1" source="ev_ctx" style="endArrow=open;endFill=0;endSize=10;startArrow=diamondThin;startFill=1;startSize=14;strokeWidth=1.5;fontSize=10;labelBackgroundColor=#FFFFFF;" target="ev_parser" value="creates all">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee2" edge="1" parent="1" source="ev_ctx" style="endArrow=open;endFill=0;endSize=10;startArrow=diamondThin;startFill=1;startSize=14;strokeWidth=1.5;fontSize=10;labelBackgroundColor=#FFFFFF;" target="ev_evalinterface" value="creates">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee3" edge="1" parent="1" source="ev_ctx" style="endArrow=open;endFill=0;endSize=10;startArrow=diamondThin;startFill=1;startSize=14;strokeWidth=1.5;fontSize=10;labelBackgroundColor=#FFFFFF;" target="ev_evaluator" value="creates">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee4" edge="1" parent="1" source="ev_ctx" style="endArrow=open;endFill=0;endSize=10;startArrow=diamondThin;startFill=1;startSize=14;strokeWidth=1.5;fontSize=10;labelBackgroundColor=#FFFFFF;" target="ev_evalctx" value="creates">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee5" edge="1" parent="1" source="ev_ctx" style="endArrow=open;endFill=0;endSize=10;strokeWidth=1.5;dashed=1;fontSize=10;labelBackgroundColor=#FFFFFF;" target="ev_iface" value="exposes">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee6" edge="1" parent="1" source="ev_evalinterface" style="endArrow=open;endFill=0;endSize=10;strokeWidth=1.5;fontSize=10;labelBackgroundColor=#FFFFFF;" target="ev_cache" value="owns">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee7" edge="1" parent="1" source="ev_evalinterface" style="endArrow=open;endFill=0;endSize=10;strokeWidth=1.5;fontSize=10;labelBackgroundColor=#FFFFFF;" target="ev_format" value="uses">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee8" edge="1" parent="1" source="ev_evalinterface" style="endArrow=open;endFill=0;endSize=10;strokeWidth=1.5;dashed=1;fontSize=10;labelBackgroundColor=#FFFFFF;" target="ev_host_ifaces" value="implements">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee9" edge="1" parent="1" source="ev_evaluator" style="endArrow=open;endFill=0;endSize=10;strokeWidth=1.5;fontSize=10;labelBackgroundColor=#FFFFFF;" target="ev_evalinterface" value="calls into">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee20" edge="1" parent="1" source="ev_ext_se" style="endArrow=open;endFill=0;endSize=10;strokeWidth=1.5;dashed=1;strokeColor=#b85450;fontSize=10;fontStyle=2;labelBackgroundColor=#FFFFFF;" target="ev_ctx" value="uses">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee21" edge="1" parent="1" source="ev_evalinterface" style="endArrow=open;endFill=0;endSize=10;strokeWidth=1.5;dashed=1;strokeColor=#b85450;fontSize=10;fontStyle=2;labelBackgroundColor=#FFFFFF;" target="ev_ext_data" value="delegates to">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee22" edge="1" parent="1" source="ev_evalinterface" style="endArrow=open;endFill=0;endSize=10;strokeWidth=1.5;dashed=1;strokeColor=#b85450;fontSize=10;fontStyle=2;labelBackgroundColor=#FFFFFF;" target="ev_ext_model" value="navigates">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ee23" edge="1" parent="1" source="ev_evalinterface" style="endArrow=open;endFill=0;endSize=10;strokeWidth=1.5;dashed=1;strokeColor=#b85450;fontSize=10;fontStyle=2;labelBackgroundColor=#FFFFFF;" target="ev_ext_target" value="queries">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>