optimize ps/2 keyboard scancodes fifo

This commit is contained in:
Eugene Lozovoy
2024-10-04 12:55:22 +03:00
parent 8a1898cf8e
commit d71b817e49

View File

@ -329,7 +329,7 @@ always @(posedge clk) begin
2'd0: begin 2'd0: begin
if (!fifo_empty) begin if (!fifo_empty) begin
fifo_rdreq <= 1'b1; fifo_rdreq <= 1'b1;
step <= step + 1'b1; step <= 2'd1;
end end
end end
@ -341,23 +341,22 @@ always @(posedge clk) begin
else else
scancode <= fifo_q[7:0]; scancode <= fifo_q[7:0];
if (scancode_ack) if (scancode_ack)
step <= step + 1'b1; step <= (fifo_q[8] || fifo_q[9])? 2'd2 : 2'd0;
end end
2'd2: begin 2'd2: begin
if (fifo_q[9] && fifo_q[8]) if (fifo_q[9] && fifo_q[8])
scancode <= 8'hF0; scancode <= 8'hF0;
else if (fifo_q[8] || fifo_q[9]) else
scancode <= fifo_q[7:0]; scancode <= fifo_q[7:0];
if (scancode_ack) if (scancode_ack)
step <= step + 1'b1; step <= (fifo_q[8] && fifo_q[9])? 2'd3 : 2'd0;
end end
2'd3: begin 2'd3: begin
if (fifo_q[9] && fifo_q[8]) scancode <= fifo_q[7:0];
scancode <= fifo_q[7:0];
if (scancode_ack) if (scancode_ack)
step <= step + 1'b1; step <= 0;
end end
endcase endcase