Minh lap toppic nay de anh em on thi cho tot mong anh em tich cuc ung ho.
Ai lam duoc bai nao thi cho len de moi nguoi xem vaf hieu de on thi nhe!
1. Thiet ke bo so sanh.
Hinh anh:
Se co code cac dang minh se thuc thi:L
1.1 Mo ta theo kieu hanh vi hoat dong dang cau lenh if
Ai lam duoc bai nao thi cho len de moi nguoi xem vaf hieu de on thi nhe!
1. Thiet ke bo so sanh.
Hinh anh:
1.1 Mo ta theo kieu hanh vi hoat dong dang cau lenh if
- Code:
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity ss is
Port ( A : in STD_LOGIC;--dau vao so sanh A
B : in STD_LOGIC;-- dau vao so sanh B
S1 : out STD_LOGIC;-- dau ra lon hon (A>B)
S2 : out STD_LOGIC;-- dau ra bang nhau(A=B)
S3 : out STD_LOGIC);-- dau ra nho hon (A<B)
end ss;
architecture Behavioral of ss is
begin
process(A,B)
begin
if(A='0' and B='0') then
S1 <= '0';
S2 <= '1';
S3 <= '0';
elsif(A = '0' and B= '1') then
S1 <= '0';
S2 <= '0' ;
S3 <= '1';
elsif (A = '1' and B = '0') then
S1 <= '1' ;
S2 <= '0';
S3 <= '0';
else
S1 <= '0';
S2 <= '1';
S3 <= '0';
end if;
end process;
end Behavioral;