summaryrefslogtreecommitdiff
path: root/nandgame/cond_check.sv
blob: dc9d334f160bdba73b25bd0b3af2dd4330e97faa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// nandgame condition checker

`timescale 1us/1us

module  cond_check #(
  parameter DATA_WIDTH = 16
) (
  input [(DATA_WIDTH-1):0] X,
  input wire ltz,
  input wire eqz,
  input wire gtz,
  output wire res
);

wire ltr, eqr, gtr, greater_zero;
assign greater_zero = X[(DATA_WIDTH - 1)] == 0;
assign ltr = ltz && !greater_zero;
assign gtr = gtz && greater_zero && !(X == 0);
assign eqr = eqz && (X == 0);

assign res = ltr || gtr || eqr;

endmodule