Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
863 Views

vhdl code for n*n matrix inversion

hello  

 

I want to write a vhdl code for real or complex matrix inversion. 

i don't know how i can send arrays of my matrix to output ports. 

 

i need your helps for writting this code because i'm beginner. 

 

tnx 

 

this is my code but it have errors: 

 

library ieee; 

use ieee.std_logic_1164.all; 

use ieee.numeric_std.all; 

use work.newtype.all; 

 

entity inverse is 

port(input: in matrix_t; 

--clk: in std_logic; 

inversed_matrix: out matrix_t); 

end inverse; 

 

architecture arch of inverse is 

function change (matrix: matrix_t) return matrix_t is 

variable ret,test: matrix_t;  

--variable a,b,c: integer ; 

begin 

--for i in matrix'range(1) loop 

--for j in matrix'range(2) loop  

test(0,0)<= matrix(1,1) * matrix(0,0); 

test(0,1)<= matrix(0,1) * matrix(1,0); 

test(1,1)<=test(0,0)-test(0,1); 

ret (0,0):= (matrix (1,1))/test(1,1);  

ret (1,1):= (matrix (0,0))/test(1,1); 

ret (0,1):= -(matrix (0,1))/test(1,1); 

ret (1,0):= -(matrix (1,0))/test(1,1); 

--end loop; 

--end loop; 

return ret; 

end ; 

--end function; 

 

 

begin 

inversed_matrix <= change (input); 

end arch; 

 

help me plz
0 Kudos