-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1bit_comp.vhd
49 lines (39 loc) · 874 Bytes
/
1bit_comp.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--------------behavioural--------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity 1bit_comp is
Port (a,b:in Std_logic;
greater,lesser,equal: out std_logic);
end 1bit_comp;
architecture Beh of 2bit_comp is
begin
process(a,b)
begin
greater<= '0';
lesser<='0';
equal<='0';
if a>b then
greater <='1';
elsif b>a then
lesser<='1'
else
equal<='1';
end if;
end process;
end Beh;
-----------------------------Data Flow------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
entity 1bit_comp is
Port (a,b:in Std_logic;
greater,lesser,equal: out std_logic);
end 1bit_comp;
Architecture DataFlow of 1bit_comp is
begin
greater<= a and (not b);
lesser<= (not a ) and b;
equal <= (a and b) or ((not a) and (not b));
end Dataflow;