for 1/x x it's real or integer answer always is zero .. and for (-y)/x answer always it's zero .. i'm confused ... for real type don't work
here my CODE
LIBRARY IEEE ;
USE IEEE.std_logic_1164.all ;
USE IEEE.numeric_std.all ;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
--use IEEE.MATH_REAL.ALL;
USE work.matrix_2by2.all ;
ENTITY matrix_inversion IS
PORT ( mat_in : IN matrix_2x2 ;
mat_invers : OUT matrix_2x2 );
END ;
ARCHITECTURE behav OF matrix_inversion IS
SIGNAL mat_det : integer ;
SIGNAL mat_adj : matrix_2x2 ;
BEGIN
-- PROCESS (mat_det)
-- BEGIN
-- IF mat_det /= 0.0 THEN
( mat_invers (0,0)) <= (mat_adj(0,0))/(mat_det) ;
( mat_invers (0,1)) <= ((mat_adj(0,1))/(mat_det)) ;
( mat_invers (1,0)) <= ((mat_adj(1,0))/(mat_det)) ;
( mat_invers (1,1)) <= (mat_adj(1,1))/(mat_det) ;
-- ELSE
-- mat_invers <= mat_in ;
-- END IF ;
-- END PROCESS ;
END ;
- - - Updated - - -
here determinant code
LIBRARY IEEE ;
USE IEEE.std_logic_1164.all ;
USE IEEE.numeric_std.all ;
-- use IEEE.MATH_REAL.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
USE work.matrix_2by2.all ;
ENTITY determinant IS
PORT ( mat_in : IN matrix_2x2 ;
mat_det : OUT integer );
END determinant;
ARCHITECTURE behav OF determinant IS
BEGIN
mat_det <= ( mat_in(0,0) * mat_in(1,1) ) - ( mat_in(0,1) * mat_in(1,0) ) ;
END behav;