- VGA 640x480@60 text display, 8x16 CP437 font ROM from Linux console fonts - USB HID keyboard (PS/2 via onboard PIC24), scan code set 2 to ASCII with xterm sequences for cursor/editing keys - UART RX/TX with switch-selectable baud, local echo option - Terminal engine: control codes, deferred wrap, hardware scroll, VT100/ANSI subset (cursor moves, erase, reverse video, cursor hide) - Vivado build/program/flash scripts and xsim whole-design testbench Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
890 B
Verilog
37 lines
890 B
Verilog
`timescale 1ns / 1ps
|
|
|
|
// Small synchronous first-word-fall-through FIFO (dout is valid while !empty).
|
|
module fifo #(
|
|
parameter W = 8,
|
|
parameter A = 4 // depth = 2**A
|
|
) (
|
|
input clk,
|
|
input rst,
|
|
input [W-1:0] din,
|
|
input wr,
|
|
input rd,
|
|
output [W-1:0] dout,
|
|
output empty,
|
|
output full
|
|
);
|
|
reg [W-1:0] mem [0:(1<<A)-1];
|
|
reg [A:0] wp, rp;
|
|
|
|
assign empty = wp == rp;
|
|
assign full = wp[A] != rp[A] && wp[A-1:0] == rp[A-1:0];
|
|
assign dout = mem[rp[A-1:0]];
|
|
|
|
always @(posedge clk)
|
|
if (wr && !full) mem[wp[A-1:0]] <= din;
|
|
|
|
always @(posedge clk) begin
|
|
if (rst) begin
|
|
wp <= 0;
|
|
rp <= 0;
|
|
end else begin
|
|
if (wr && !full) wp <= wp + 1'b1;
|
|
if (rd && !empty) rp <= rp + 1'b1;
|
|
end
|
|
end
|
|
endmodule
|