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 TTC processor. Use the FPMUL instruction menomic. The multiply function should conform to the arithmetic approximation outlined on the previous page. Assume that the operands are already in 4.28 fixed point format.

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 ttcsim.do to simulate your machine code. Use the TestTinyComp module in ttc_test.sv to test the following multiplications (alter the test input vectors as described in the comments in the file):

0.0 * 1.0
expected result is 0.0
-1.0 * -2.0
expected result is 2.0 i.e. 536870912 when 4.28 fixed point is rendered as an integer
-0.5 * 0.5
expected result is -1.0 i.e. 4227858432
Previous  |  Contents  |  Next