Lab7: Finite State Machines (Matrix Multiply) | ||
TOC
|
Objective:Use a datapath with finite state machine control to implement a [4x4] * [4x1] = [4x1] matrix multiply. This lab is worth 50% more than previous labs (150 points instead of 100). Background TOCThree dimensional computer graphic applications require coordinate manipulations such as translation, rotation, and scaling. Three dimensional coordinates (X,Y,Z) can transformed into homogeneous coordinates (X',Y',Z',W') where X=X'/W', Y=Y'/W', Z=Z'/W'. For most applications, W=1. The homogeneous coordinates allow translation, rotation, and scaling to be performed in a consistent manner via matrix multiplications. The matrix multiplication is T * S = S' where T is a [4x4] transformation matrix, S is the original coordinate [4x1], and S' is the transformed coordinate. Several transformations can be applied to a coordinate by successive matrix multiplications. These operations can be done via software or specialized hardware. Typically the transformation operations are performed in floating point. To Do TOCYou are to implement a [4x4][4x1] matrix multiply using fixed point arithmetic. The matrix coefficients are 9 bit values as used for the 'F' variable in the blend equation. The coordinate values are 8-bit unsigned quantities (in actual graphic applications both matrix coefficients and coordinate values would be floating point numbers). The interface of the matrix multiply block is defined as follows: Inputs
Outputs
The transformation matrix coefficients are:
The input coordinate is [X, Y, Z, W]. The transformed coordinate is computed as:
The multiplication is the 9bit * 8bit unsigned multiplication used in the blend equation; the addition is an unsigned saturating addition. Note that if the matrix is the identity matrix:
then X'=X, Y'=Y, Z'=Z, W'=W (this is good test of your matrix multiply). When the cf_load input is asserted, the coordinates are presented in ROW major order (T00, T01, T02, T03, T04, T05, .... T13, T14, T15). When the cf_dump input is asserted, the coefficients should be written to the coeffs output bus in the same order. When the start input is asserted, the coordinate is presented at X, Y, Z, W. Study the golden files to learn more about the cycle behavior of these inputs and outputs. Implementation Requirements TOC
Testing TOCYou can use this schematic (tbmm.gdf) as the testbench. This a design problem, which means that there are multiple solutions that will meet the specifications. You will NOT be able to compare your output waveform against the 'golden' waveforms that I have provided. The golden waveforms are actually intended to be reference waveforms to show you how the circuit is supposed to behave. The counter that is included in the testbench is used to keep track of how long your circuit takes to do a matrix multiply (it works off the start and busy signals). Reference waveforms:
Even though your waveform will not match this operation exactly because you may take more or less cycles to perform the computation, it is expected that the cycle operation of your output_rdy and busy signals in reference to the start and output data will be the same (i.e, busy is asserted the clock cycle after start is asserted, output_rdy is asserted anytime valid data is on the coeffs or dout busses.)
Check Off TOCWeek 1: You must demonstrate that you are able to load the matrix into your design, and then dump it out. You should not be satisfied with just getting this work for week 1 but should also start on the second part as well. There is no report due at this time - just a checkoff. If you are NOT ready at this time, you can make AT MOST 80% on this lab even if you get everything working at a later date. Week 2: You must have everything working. Your REPORT is due at this time. Report TOC
|
|