mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-31 03:05:21 +00:00
Blitter6502OISC_small.v: - Added uart_sent flag to prevent UART retransmission - Verified via Verilator: UART sends exactly one byte on halt - Test byte: 0xAA (recognizable pattern) research_stack_top.v: - Auto-start logic (100ms after reset, no button needed) - LED shows heartbeat when CPU running, register values on halt research_stack_tangnano9k.cst: - uart_tx=17, uart_rx=18 (matches Sparkle reference design) Simulation results (Verilator): - uart_test.v: 115 bytes in 300K cycles (continuous TX verified) - research_stack_top: UART fires after Blitter halt, 0xAA byte sent - LED pattern changes from IDLE to RUNNING to HALTED
40 lines
1.1 KiB
Verilog
40 lines
1.1 KiB
Verilog
// Minimal UART test: sends 'R' (0x52) continuously at 115200 baud
|
|
// Verifies FT2232 channel B ↔ FPGA pin 18 connection
|
|
|
|
module uart_test (
|
|
input wire clk,
|
|
output wire uart_tx,
|
|
output wire [5:0] led
|
|
);
|
|
|
|
// 27MHz / 234 = 115384 baud
|
|
localparam BAUD_DIV = 16'd233;
|
|
localparam TEST_BYTE = 8'h52; // 'R' for Research Stack
|
|
|
|
assign led = 6'b101010; // Pattern to confirm FPGA is alive
|
|
|
|
reg [15:0] baud_cnt = 0;
|
|
reg [3:0] bit_cnt = 0;
|
|
reg [9:0] shift_reg = 10'b1111111111;
|
|
reg tx_out = 1'b1;
|
|
assign uart_tx = tx_out;
|
|
|
|
always @(posedge clk) begin
|
|
if (baud_cnt >= BAUD_DIV) begin
|
|
baud_cnt <= 0;
|
|
if (bit_cnt == 0) begin
|
|
// Load start bit + data + stop bit
|
|
shift_reg <= {1'b1, TEST_BYTE, 1'b0};
|
|
bit_cnt <= 10;
|
|
tx_out <= 1'b0; // Start bit
|
|
end else begin
|
|
tx_out <= shift_reg[0];
|
|
shift_reg <= {1'b1, shift_reg[9:1]};
|
|
bit_cnt <= bit_cnt - 1;
|
|
end
|
|
end else begin
|
|
baud_cnt <= baud_cnt + 1;
|
|
end
|
|
end
|
|
|
|
endmodule
|