diff --git a/hw/application_fpga/fw/tk1/main.c b/hw/application_fpga/fw/tk1/main.c index 524b0dc..fc50c4b 100644 --- a/hw/application_fpga/fw/tk1/main.c +++ b/hw/application_fpga/fw/tk1/main.c @@ -54,7 +54,9 @@ static enum state loading_commands(const struct frame_header *hdr, const uint8_t *cmd, enum state state, struct context *ctx); static void run(const struct context *ctx); +#if !defined(SIMULATION) static uint32_t xorwow(uint32_t state, uint32_t acc); +#endif static void scramble_ram(void); static void print_hw_version(void) @@ -364,6 +366,7 @@ static void run(const struct context *ctx) __builtin_unreachable(); } +#if !defined(SIMULATION) static uint32_t xorwow(uint32_t state, uint32_t acc) { state ^= state << 13; @@ -372,9 +375,13 @@ static uint32_t xorwow(uint32_t state, uint32_t acc) state += acc; return state; } +#endif static void scramble_ram(void) { + // Can't fill RAM if we are simulating, data has already been loaded + // into RAM. +#if !defined(SIMULATION) uint32_t *ram = (uint32_t *)(TK1_RAM_BASE); // Fill RAM with random data @@ -386,6 +393,7 @@ static void scramble_ram(void) data_state = xorwow(data_state, data_acc); ram[w] = data_state; } +#endif // Set RAM address and data scrambling parameters *ram_addr_rand = rnd_word(); @@ -414,6 +422,10 @@ int main(void) scramble_ram(); +#if defined(SIMULATION) + run(&ctx); +#endif + for (;;) { switch (state) { case FW_STATE_INITIAL: