Hey, I'm making a binary ordering. I have two questions: 1. Is there any way that I can make this code simpler? 2. Can I make this code concurrent or sequential using the functions I already write on top?
Thanks, ;D
package MY_PACKAGE is function portaand(SIGNAL A , B: in bit) return bit; function portaor(SIGNAL A , B: in bit) return bit; END MY_PACKAGE;
PACKAGE BODY MY_PACKAGE is FUNCTION portaand (SIGNAL A, B: bit ) RETURN bit IS BEGIN RETURN A AND B; END portaand;
FUNCTION portaor (SIGNAL A, B: bit ) RETURN bit IS BEGIN RETURN A OR B; END portaor;
END MY_PACKAGE;
use work.MY_PACKAGE.all;
entity ORDENADORBINARIO is PORT ( n4, n3,n2,n1,n0 : IN bit; y4,y3,y2,y1,y0 : OUT bit ); end ORDENADORBINARIO;
architecture Behavioral of ORDENADORBINARIO is SIGNAL x0,x1,x2,x3,z0,z1,z2,w0,w1,w2,o0,o1,p0,p1,q0 : bit; begin x0 <= portaand( n4 , n3 ); z0 <= portaor( n4 , n3 ); x1 <= portaand( n2 , z0 ); z1 <= portaor( n2 , z0 ); x2 <= portaand( n1 , z1 ); z2 <= portaor( n1 , z1 ); x3 <= portaand ( z2, n0); w0 <= portaand ( x0, x1) ; o0 <= portaor ( x0, x1) ; w1 <= portaand ( o0, x2) ; o1 <= portaor ( o0, x2) ; w2 <= portaand ( o1 , x3) ; p0 <= portaand (w0 , w1) ; q0 <= portaor( w0,w1); p1 <= portaand ( w2 , q0);
y4 <= portaor (n0, z2); y3 <= portaor (o1, x3) ; y2 <= portaor ( w2, q0); y1 <= portaand (p0 , p1 ); y0 <= portaor (p0 , p1);
end Behavioral;