Professional Documents
Culture Documents
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 29.10.2022 22:51:49
// Design Name:
// Module Name: Tx_32
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module uart_tx_32(
input clk,
input enable,
output tx_out,
output reg tx_done
);
reg [31:0]data;
module uart_tx_clk(
input clk,
output reg clk_out
);
reg [20:0]count;
always @ (posedge clk)begin
if(count == 868) //baud rate is 115200
count <= 0;
else
count <= count + 1;
module uart_tx(
reset ,
txclk ,
ld_tx_data ,
tx_data ,
tx_enable ,
tx_out ,
tx_empty
);
// Port declarations
input reset ; // to rst pin
input txclk ; // set Baud rate as txclk clock frequency
input ld_tx_data ; // load tx data to tx register when '1'
input [7:0] tx_data ; // tx data 8-bit data input
input tx_enable ; // transmit when enable
output tx_out ; // Serial port pin; goes to pin PACKAGE_PIN
C4(nexys4)
output tx_empty ; // give this pin to Spartan-3E LED
// Internal Variables
reg [7:0] tx_reg ;
reg tx_empty ;
reg tx_over_run ; //********************** Unused
reg [3:0] tx_cnt ; //counter
reg tx_out ; // serial output
// UART TX Logic
always @ (posedge txclk or posedge reset)
if (reset) begin
tx_reg <= 0;
tx_empty <= 1;
tx_over_run <= 0; //********************** Unused
tx_out <= 1; // default high
tx_cnt <= 0;
end else begin
if (ld_tx_data) begin//when 1
if (!tx_empty) begin // when 0(not empty)
tx_over_run <= 0;
end else begin
tx_reg <= tx_data;// load tx_data when empty
tx_empty <= 0;
end
end
if (tx_enable && !tx_empty) begin// when clk is high and reg is not empty and
tx_en is high
endmodule
#############**************************XDC
FILE******************#######################
## This file is a general .xdc for the Nexys4 DDR Rev. C
## To use it in a project:
## - uncomment the lines corresponding to used pins
## - rename the used ports (in each line, after get_ports) according to the top
level signal names in the project
## Clock signal
set_property -dict { PACKAGE_PIN E3 IOSTANDARD LVCMOS33 } [get_ports { clk }];
#IO_L12P_T1_MRCC_35 Sch=clk100mhz
#create_clock -add -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports
{CLK100MHZ}];
##Switches
## LEDs