Skip to main content

Module decision_workload

Module decision_workload 

Source
Expand description

The HFT decision as a workload: its one LOGOS source, lowered to a combinational select-DAG by emit_decision_fabric (the decision fabric), and run as ordinary bytecode on the routable scalar core by the program here — the CPU twin of decision_hft_realbist. Both blocks decide over the same realistic input ranges, so their gate-level switching power per decision is one comparison.

Constants§

DECIDE_FN
The HFT decision: microprice market-making, a fat-finger clamp and a position risk gate, returning the signed order (+buy / -sell / 0). No division — the microprice arrives normalized — so the body is compare / arithmetic / branch only.
DECIDE_NAME
The function name DECIDE_FN defines.
LCG_A
The CPU twin’s stimulus: a 15-bit linear congruential generator, s’ = (s * A + C) mod 2^15. A ≡ 1 (mod 4) with C odd gives the full period of 32768 (Hull–Dobell), and every product stays below 2^31, so the 32-bit core and the 64-bit VM compute it identically.
LCG_C
LCG_MASK
SOFT_CORE_REALBIST_ITERATIONS
Decisions the boot ROM makes before it halts — far more than any measured window spans.

Functions§

inline_body
The body of the single-Return function func spliced in at indent spaces, and the expression its final Return e. yields. Each parameter is bound to its argument: an integer literal is substituted at every whole-word use (a constant needs no register of its own), an argument that is the parameter’s own name needs no binding, and anything else is bound by Let. Refused: an argument count that is not the arity, and any Return other than the body’s last line — its early exit has no inline equivalent.
inline_call
inline_body, with the returned value assigned to the already-declared result.
soft_core_realbist_program
The boot ROM the block ships: the program at SOFT_CORE_REALBIST_ITERATIONS, encoded for the scalar core.
soft_core_realbist_source
The CPU twin’s program: each iteration advances the LCG three times, mapping each output onto the realbist’s input ranges as it is drawn, runs the decision inline, and shows signed_order * 4 + order_side — the whole decision, side included, so the output stream classifies every decision as buy, sell, risk-blocked or no-trade.
soft_core_realbist_verilog
The block’s top: the scalar core itself, whose $readmemh("program.hex") boot ROM holds soft_core_realbist_program. Only clk and rst enter; the decision stream leaves on out.