Description
We now introduce the data memory (a much larger place for storing data than the register file).
The objective is to this time store the Fibonacci sequence (which we generated in last assignment) into the data ram in consecutive addresses (starting from address zero), and then read it back and display it comma-separated on the TTY ascii display.
We need to add a Ram unit, and “load” and “store” instructions to our instruction set. We will additionally be making some tweaks to the jump and TTY instructions.
Copyright By PowCoder代写 加微信 powcoder
Less detailed steps are given. The assignment’s objective is that you think about how we need to change the decode circuitry and your code to achieve the criterion.
Outline Steps
1) Add a new Ram with 256 entries of 8-bit data (“separate” input/out ports). Connect its address bus to the output of the ALU. This is our Data Ram. Label it so we don’t mix it up with other rams.
2) Use two of the instruction decoder outputs to implement new Data Load and Store instructions.
Our new “Load” instruction must retrieve data from this Ram, at the address pointed to by the register (specified in the instruction) plus Immediate (specified in the instruction), and must Store the value to the Accumulator. Hint: Ask yourself where the input to the Accumulator can now come from? (until now its only come from the ALU output) And when does the Accumulator’s “Enable” pin now need to go high?
Our new “Store” instruction must store the value in the accumulator to this Ram, at the address pointed to by the register (specified in the instruction) plus Immediate (specified in the instruction). Hint: Ask yourself where the Data input to the new Ram comes from for this? And when do we need to enable the new ram’s “str” pin?
How do we connect the decoder outputs to achieve this?
3) Disconnect the “Data” input to the TTY display (from the immediate portion of instruction), and instead connect to the lower 7 bits of the Accumulator. Our TTY display instruction now displays the accumulator value instead of the immediate value, so we can load values from memory and display it.
4) Until now our jump instruction has been unconditional. Lets convert it to a conditional jump (so that… you know… we can exit loops). To do this with minimum changes lets make the condition that the register specified in the instruction is not equal to the accumulator.
Hint: Add a “Comparator” unit (available under Arithmetic). Connect one of its inputs to the Register file output and the other to the accumulator. How would you use the output of this comparator to now control the Program Counter “Load” pin?
I will open your .cir file and load the instruction ram with your data image. When I hit the clock I must see the Fibonacci sequence generated at the accumulator output display, and stored to the new Data ram in consecutive addresses starting from address zero. When the sequence reaches 233 (0xE9) it must exit the loop, and start reading the sequence from the data Ram, and display it comma-separated on the TTY display (ascii encoding for comma character is 44 or 0x2C).
Code Hints:
If you make one of the unused registers initialize to 233 at the beginning of your code, and set the register field of your fibo generation jump instruction equal to that register, it should exit the loop once you reach 233.
Also remember that in the ascii encoding the number characters start from 48 (0x30). So when displaying the sequence from memory, you will need to add 48 to the accumulator to display properly in ascii (how do you do this in your code? Recall we have an immediate+accum instruction). Note: The TTY will display numbers in the fibo sequence above 8 incorrectly — that’s fine. We’ll fix it in later assignments.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com