Jose's awesome way to test zero structurally!
This commit is contained in:
@@ -1055,12 +1055,9 @@ endmodule
|
|||||||
|
|
||||||
module zero(
|
module zero(
|
||||||
input wire [8:0] A,
|
input wire [8:0] A,
|
||||||
output reg [8:0] B);
|
output wire [8:0] B);
|
||||||
|
|
||||||
always @(A) begin
|
assign B = {8'b00000000, A[8] | A[7] | A[6] | A[5] | A[4] | A[3] | A[2] | A[1] | A[0]};
|
||||||
if(A == 9'b000000000)
|
// 0 if zero
|
||||||
B = 9'b000000001; // 1 if A is zero
|
// 1 if non-zero
|
||||||
else
|
|
||||||
B = 9'b000000000; // 0 if A is non-zero
|
|
||||||
end
|
|
||||||
endmodule
|
endmodule
|
||||||
Reference in New Issue
Block a user