Computer Laboratory

ECAD and Architecture Practical Classes

Exercise 1

Behaviour

Add a 4.28 fixed point multiply function to the Arithmetic and Logic Unit (ALU) of the given TTC processor core. Use the FPMUL case for this purpose. The multiply function should conform to the arithmetic approximation outlined on the previous page.

Implementation Advice

Open ttc.sv and find the alu function implementing the ALU. Taking RaVal and RbVal as 4.28 fixed point Words, change the FPMUL case of the first switch statement to update pre_shift with the required result.

You may like to consider the following function, which relies on the type definitions in ttc.sv:

Testing

Download into the directory for this lablet the following file:

fpmul.asm
TTC assembly. An example program multiplying two 4.28 fixed point numbers.

Assemble the given program using the rmb format. Modify the "do" script to simulate your machine code. Use the TestTinyComp module in ttc_test.sv to test the following multiplications:

0.0 * 1.0
expected result is 0.0
-1.0 * -2.0
expected result is 2.0 i.e. 536870912
-0.5 * 0.5
expected result is -1.0 i.e. 4227858432
Previous  |  Contents  |  Next