Re: 求教一道面试题
module test (/*AUTOARG*/
// Outputs
q_o,
// Inputs
clka_i, clkb_i, reset_n_i
) ;
input clka_i;
input clkb_i;
input reset_n_i;
output q_o;
reg outbuff_pos;
reg outbuff_neg;
assign q_o = outbuff_pos ^ outbuff_neg;
always @ ( negedge reset_n_i or posedge clka_i) begin
if (!reset_n_i) begin
/*autoreset*/
// Beginning of autoreset for uninitialized flops
outbuff_pos <= 1'h0;
// End of automatics
end
else if (1) begin
if (outbuff_neg == 0) begin
outbuff_pos <= 1;
end
else begin
outbuff_pos <= 0;
end
end
end
always @ ( negedge reset_n_i or negedge clkb_i) begin
if (!reset_n_i) begin
/*autoreset*/
// Beginning of autoreset for uninitialized flops
outbuff_neg <= 1'h0;
// End of automatics
end
else if (1) begin
if (outbuff_pos == 0) begin
outbuff_neg <= 0;
end
else begin
outbuff_neg <= 1;
end
end
end
endmodule // test