Skip to main content

Module predictive_coding

Module predictive_coding 

Source
Expand description

Predictive coding via XOR + popcount in packed bitstream domain.

Error = XOR(predicted, actual), magnitude = popcount(error) / L. No multiplications needed — maps to XOR gates + popcount tree on FPGA.

Functions§

batch_prediction_error
Batch prediction error: n_neurons × n_inputs packed streams. Returns per-neuron surprise values.
predict_and_xor_ema
EMA predict-and-XOR loop for spike codec compression. Returns (error_matrix flattened row-major, correct_prediction_count).
predict_and_xor_lfsr
LFSR predict-and-XOR loop: bit-true with sc_bitstream_encoder.v. Returns (error_matrix flattened row-major, correct_prediction_count).
prediction_error_packed
Compute prediction error between two packed bitstreams via XOR + popcount. Returns error magnitude in [0, 1].
update_prediction_weights
STDP-like weight update: push prediction weight toward actual probability.
xor_and_recover_ema
EMA XOR-and-recover loop for spike codec decompression.
xor_and_recover_lfsr
LFSR XOR-and-recover loop for decompression.