Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16606 Discussions

vhdl code for n*n matrix inversion

Altera_Forum
Honored Contributor II
1,813 Views

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
0 Replies
Reply