diff options
| author | Julian Blake Kongslie | 2021-04-04 14:16:27 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2021-04-04 14:16:27 -0700 |
| commit | 6fb37d5f47629817a5092da40217bde5ca0ed4fa (patch) | |
| tree | a4f176f62cce9ca66806445ab9a0ca4e7543def7 /hdl/top.sv | |
| parent | Remove unneeded .exe suffixes in bat scripts. (diff) | |
| download | noncpu-6fb37d5f47629817a5092da40217bde5ca0ed4fa.tar.xz | |
Very fancy improved Fibonacci machine, with HDL convert-to-ASCII functionality
Diffstat (limited to '')
| -rw-r--r-- | hdl/top.sv | 11 |
1 files changed, 11 insertions, 0 deletions
| @@ -120,6 +120,11 @@ always_ff @(posedge clk) begin | |||
| 120 | 'h2: state = AGEN; | 120 | 'h2: state = AGEN; |
| 121 | 'h3: if (acc != sign_extended_operand) ++pc; | 121 | 'h3: if (acc != sign_extended_operand) ++pc; |
| 122 | 'h4: pc = pc + sign_extended_operand; | 122 | 'h4: pc = pc + sign_extended_operand; |
| 123 | 'h5: begin | ||
| 124 | mem_write_data = acc % 10 + 'h30; | ||
| 125 | acc = acc / 10; | ||
| 126 | state = AGEN; | ||
| 127 | end | ||
| 123 | 'hf: begin | 128 | 'hf: begin |
| 124 | if (operand[0]) ++acc; | 129 | if (operand[0]) ++acc; |
| 125 | if (operand[1]) --acc; | 130 | if (operand[1]) --acc; |
| @@ -152,6 +157,12 @@ always_ff @(posedge clk) begin | |||
| 152 | mem_write_data = acc; | 157 | mem_write_data = acc; |
| 153 | state = `mem_ready ? FETCH : AGEN; | 158 | state = `mem_ready ? FETCH : AGEN; |
| 154 | end | 159 | end |
| 160 | 'h5: begin | ||
| 161 | mem_valid = 1; | ||
| 162 | mem_address = {2'b0, idx + sign_extended_operand}; | ||
| 163 | mem_write = 1; | ||
| 164 | state = `mem_ready ? FETCH : AGEN; | ||
| 165 | end | ||
| 155 | endcase | 166 | endcase |
| 156 | end | 167 | end |
| 157 | 168 | ||
