-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomparator.v
47 lines (45 loc) · 933 Bytes
/
comparator.v
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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:11:06 03/26/2017
// Design Name:
// Module Name: comparator
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module comparator(
input [1:0] DataA,
input [1:0] DataB,
output reg equal,
output reg lower,
output reg greater
);
always @* begin
if (DataA<DataB) begin
equal = 0;
lower = 1;
greater = 0;
end
else if (DataA==DataB) begin
equal = 1;
lower = 0;
greater = 0;
end
else begin
equal = 0;
lower = 0;
greater = 1;
end
end
endmodule