fixed point toolbox

1 visualización (últimos 30 días)
fit institute
fit institute el 15 de Mzo. de 2011
Respondida: arushi el 20 de Ag. de 2024
I need to compute T=C*X where C and X are 8*8 matrices (Matrix multiplication includes multiplication of corresponding rows and colums followed by addition)
the wordlength for my multiplier module is 16 bits and adder module is 17 bits....
1)How can this be done ..... 2)How can i verify the results that I'm getting is correct ,if i'm using the above mentioned wordlengths......
can anyone explain?

Respuestas (1)

arushi
arushi el 20 de Ag. de 2024
Hi Fit,
To compute the matrix multiplication ( T = C \times X ), where both ( C ) and ( X ) are ( 8 \times 8 ) matrices, follow the standard matrix multiplication procedure, which involves the dot product of rows and columns.Here are the steps:
Step 1: Matrix Multiplication
For each element ( T_{ij} ) in the resulting matrix ( T ):
[ T_{ij} = \sum_{k=1}^{8} C_{ik} \times X_{kj} ]
This means you multiply each element of the ( i )-th row of ( C ) by the corresponding element of the ( j )-th column of ( X ), then sum these products.
Step 2: Implementing with Fixed Wordlengths
Given that your multiplier has a 16-bit wordlength and your adder has a 17-bit wordlength, you need to ensure that:
  • Multiplication: Each multiplication operation results in a 16-bit product. If the inputs are also 16 bits, the product could be up to 32 bits (in a typical unsigned multiplication), so you may need to handle overflow or truncate to fit within 16 bits.
  • Addition: The sum of the products for each element ( T_{ij} ) must fit within 17 bits. This may require careful management of intermediate results to avoid overflow.
Step 3: Verification
To verify the correctness of the results:
  1. Simulate with High Precision: Perform the matrix multiplication using a software tool (e.g., MATLAB, Python with NumPy) with higher precision (e.g., double precision) to get a reference result.
  2. Compare Results: Compare your hardware implementation results with the reference results. Check for discrepancies due to overflow or precision loss.
  3. Range Checking: Ensure that all intermediate values during multiplication and addition stay within the allowable range for 16-bit and 17-bit numbers, respectively. You can do this by:
  • Overflow Detection: Implement checks in your design to flag if any intermediate result exceeds the wordlength limits.
  • Error Metrics: Calculate error metrics like Mean Absolute Error (MAE) or Mean Squared Error (MSE) between your results and the reference results to quantify any precision loss.
Hope this helps.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by