// // // Epically Simple UART Transmitter for FPGA/ASIC targets // Adrian Tang 2017 // // You need to clock at 7.5 MS to get 9600 baud // // Verilog 2001 // // Usage // // 1. reset = 0 // 2. Apply tx_byte // 3. reset = 1 // 4. data is sent // 5. send_done goes high when finished //module UART(reset, clk, tx_byte, TXD, send_done, baud_clock); module UART(reset, clk, TXD, tx_byte, send_done, baud_clock); //This parameter sets the division ratio to achieve the correct bit time for the RS232 signal parameter baud_count = 13'd126; //Main Block Control input clk; //mater clock on the block (7.5 MS/s) input reset; //master reset to singal the start of each byte transmitted //data input input [7:0] tx_byte; //byte to be transmitted //data output output TXD; //output transmit signal reg TXD; output send_done; //output led indicating transmission is done reg send_done; //internal registers reg [4:0] packet_counter; //counts the position in the packet reg [12:0] baud_counter; //counts the baud division factor //clock generation relat output baud_clock; //output to monitor the baud clock rate reg baud_clock; always@ (posedge clk) begin //always on clock synchronous operation if(reset == 0) begin //RESET all the conditions baud_counter <=12'd0; baud_clock<=1'b0; send_done <=1'b0; packet_counter<=5'd0; TXD<=1'b1; end //reset=0 //UART CORE IS RUNNING if(reset == 1) begin //CHECK THE BAUD DIVIDDER if(baud_counter