From f3092799de44cb357c96706961db38e3c62344c6 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Mon, 29 Mar 2021 14:39:48 -0700 Subject: Add a Fibonacci sequence to the end of output (no ASCII conversion yet) --- hdl/top.sv | 2 +- mem/mem.hex | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/hdl/top.sv b/hdl/top.sv index d224561..35279d4 100644 --- a/hdl/top.sv +++ b/hdl/top.sv @@ -165,7 +165,7 @@ always_ff @(posedge clk) begin case (opcode) 'h1: begin if (`mem_read_valid) begin - acc = `mem_read_data; + acc = acc + `mem_read_data; end else begin state = MEMORY; end diff --git a/mem/mem.hex b/mem/mem.hex index 5c6ebe7..3979364 100644 --- a/mem/mem.hex +++ b/mem/mem.hex @@ -2,11 +2,27 @@ 040 // acc= 0x40 f20 // idx -100 // loop: load +000 // loop: acc= 0 +100 // load 300 // ifeq 0 -f80 // halt +402 // jmp fib f44 // ++idx tx -4fb // jmp loop +4fa // jmp loop +040 // fib: acc= 0x40 +f20 // idx +000 // acc= 0 +200 // store +f04 // ++idx +001 // acc= 1 +200 // store +f08 // fibloop: --idx +000 // acc= 0 +100 // load +f44 // ++idx tx +100 // load +f04 // ++idx +200 // store +4f8 // jmp fibloop @40 @@ -26,12 +42,3 @@ f44 // ++idx tx 00a // \n 000 - -04f // O -06f // o -070 // p -073 // s -021 // ! -00a // \n - -000 -- cgit v1.2.3