feat: add two-path bias amplifier with random walk and majority vote stages (FPGA v6)
This commit is contained in:
parent
5305d66102
commit
8541cce59c
11 changed files with 741 additions and 58 deletions
|
|
@ -8,6 +8,7 @@
|
|||
// cap start a capture with the current settings and send it as
|
||||
// "DATA <n>\n" followed by n raw bytes
|
||||
// stats print the latest statistics trial snapshot as hex
|
||||
// amp print the latest bias amplifier trial snapshot as hex
|
||||
|
||||
#include <SPI.h>
|
||||
#include <VidorBoot.h>
|
||||
|
|
@ -25,6 +26,7 @@ enum : uint8_t {
|
|||
REG_STATUS = 0x0C,
|
||||
REG_DATA = 0x10,
|
||||
REG_STATS = 0x40,
|
||||
REG_AMP = 0x42,
|
||||
};
|
||||
|
||||
const uint8_t READ = 0x80;
|
||||
|
|
@ -32,7 +34,8 @@ const uint8_t CONTROL_START_CAPTURE = 0x01;
|
|||
const uint8_t STATUS_CAPTURE_DONE = 0x02;
|
||||
const size_t CAPTURE_BYTES = 32768;
|
||||
const size_t CHUNK_BYTES = 512;
|
||||
const size_t SNAPSHOT_BYTES = 72;
|
||||
const size_t STATS_SNAPSHOT_BYTES = 72;
|
||||
const size_t AMP_SNAPSHOT_BYTES = 44;
|
||||
|
||||
VidorUtils fpga;
|
||||
|
||||
|
|
@ -92,9 +95,9 @@ void capture() {
|
|||
}
|
||||
}
|
||||
|
||||
void printSnapshot() {
|
||||
beginTransaction(READ | REG_STATS);
|
||||
for (size_t i = 0; i < SNAPSHOT_BYTES; i++) {
|
||||
void printSnapshot(uint8_t reg, size_t length) {
|
||||
beginTransaction(READ | reg);
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
uint8_t value = strixSpi.transfer(0);
|
||||
if (value < 0x10) Serial.print('0');
|
||||
Serial.print(value, HEX);
|
||||
|
|
@ -131,7 +134,9 @@ void handleCommand(String line) {
|
|||
} else if (command == "cap") {
|
||||
capture();
|
||||
} else if (command == "stats") {
|
||||
printSnapshot();
|
||||
printSnapshot(REG_STATS, STATS_SNAPSHOT_BYTES);
|
||||
} else if (command == "amp") {
|
||||
printSnapshot(REG_AMP, AMP_SNAPSHOT_BYTES);
|
||||
} else if (line.length() > 0) {
|
||||
Serial.println("ERR unknown or malformed command");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue