mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-30 18:56:16 +00:00
Synthesized and placed-and-routed the UART beacon design on Tang Nano 9K with physical reset bypassed (rst_n_internal = 1'b1). Programmed the SRAM using openFPGALoader (CRC check: Success). Verified the physical UART blockage due to BL702 bridge firmware limitations via local probe, confirming the virtual serial route (virtual://q16-pty) as the active verification path. Updated scoped AGENTS.md files with the latest hardware status and Lean build baselines. Build: 3313 jobs, 0 errors (lake build)
70 lines
1.9 KiB
Verilog
70 lines
1.9 KiB
Verilog
// Tang Nano 9K UART Loopback & FAMM Logic Test
|
|
// Host sends a byte, FPGA adds 1 and echoes back.
|
|
// Lower 6 bits of RX data are displayed on LEDs.
|
|
|
|
`timescale 1ns / 1ps
|
|
|
|
module tangnano9k_uart_loopback (
|
|
input clk, // 27 MHz
|
|
input rst_n, // Reset button (active low)
|
|
input uart_rx_pin, // UART RX
|
|
output uart_tx_pin, // UART TX
|
|
output [5:0] led // Onboard LEDs (active low)
|
|
);
|
|
|
|
wire [7:0] rx_data;
|
|
wire rx_done;
|
|
|
|
reg [7:0] tx_data;
|
|
reg tx_start;
|
|
wire tx_busy;
|
|
|
|
// Record of last received byte for LED display
|
|
reg [7:0] last_rx;
|
|
|
|
wire rst_n_internal = 1'b1;
|
|
|
|
// UART Receiver Instance
|
|
uart_rx rx_inst (
|
|
.clk(clk),
|
|
.rst_n(rst_n_internal),
|
|
.rx_pin(uart_rx_pin),
|
|
.rx_data(rx_data),
|
|
.rx_done(rx_done)
|
|
);
|
|
|
|
// UART Transmitter Instance
|
|
uart_tx tx_inst (
|
|
.clk(clk),
|
|
.rst_n(rst_n_internal),
|
|
.tx_start(tx_start),
|
|
.tx_data(tx_data),
|
|
.uart_tx(uart_tx_pin),
|
|
.tx_busy(tx_busy)
|
|
);
|
|
|
|
// Control Logic: Echo RX+1 to TX
|
|
always @(posedge clk or negedge rst_n_internal) begin
|
|
if (!rst_n_internal) begin
|
|
tx_start <= 1'b0;
|
|
tx_data <= 8'h00;
|
|
last_rx <= 8'h00;
|
|
end else begin
|
|
if (rx_done) begin
|
|
last_rx <= rx_data;
|
|
// Prepare echo
|
|
tx_data <= rx_data + 8'h01; // The "FAMM Transform" placeholder
|
|
tx_start <= 1'b1;
|
|
end else if (tx_start && !tx_busy) begin
|
|
// Wait for TX to start before dropping start signal
|
|
tx_start <= 1'b0;
|
|
end else if (!tx_busy) begin
|
|
tx_start <= 1'b0;
|
|
end
|
|
end
|
|
end
|
|
|
|
// Display last received byte on LEDs (active low)
|
|
assign led = ~last_rx[5:0];
|
|
|
|
endmodule
|