resolve errors due to change in directory
This commit is contained in:
parent
79a2c63bb8
commit
26ae0cd660
|
|
@ -1,2 +1,3 @@
|
|||
formal/ddr3_multiconfig_prf*
|
||||
formal/ddr3_singleconfig/
|
||||
formal/ddr3_singleconfig/
|
||||
example_demo/nexys_video/build/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Generated by https://github.com/FPGAOL-CE/caas-wizard
|
||||
BUILDDIR := ${CURDIR}/build
|
||||
# TOP := nexysvideo_ddr3
|
||||
# SOURCES := $(wildcard *.v ../rtl/ddr3*.v ../arty_s7/verilog-uart/rtl/*.v)
|
||||
# SOURCES := $(wildcard *.v ../../rtl/ddr3*.v)
|
||||
# XDC := $(wildcard $(wildcard Nexys-video.xdc) $(wildcard Nexys-video-vivado.xdc) )
|
||||
|
||||
# PART := xc7a200tsbg484-1
|
||||
|
|
@ -23,7 +23,7 @@ ${BUILDDIR}/vivado.tcl: ${BUILDDIR}
|
|||
create_project -part xc7a200tsbg484-1 -force v_proj
|
||||
set_property target_language Verilog [current_project]
|
||||
cd ..
|
||||
read_verilog [glob *.v ../rtl/ddr3*.v ../arty_s7/verilog-uart/rtl/*.v]
|
||||
read_verilog [glob *.v ../../rtl/ddr3*.v]
|
||||
read_xdc [glob $(wildcard Nexys-video.xdc) $(wildcard Nexys-video-vivado.xdc) ]
|
||||
cd build
|
||||
synth_design -top nexysvideo_ddr3
|
||||
|
|
|
|||
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2014-2017 Alex Forencich
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// Language: Verilog 2001
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* AXI4-Stream UART
|
||||
*/
|
||||
module uart #
|
||||
(
|
||||
parameter DATA_WIDTH = 8
|
||||
)
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* AXI input
|
||||
*/
|
||||
input wire [DATA_WIDTH-1:0] s_axis_tdata,
|
||||
input wire s_axis_tvalid,
|
||||
output wire s_axis_tready,
|
||||
|
||||
/*
|
||||
* AXI output
|
||||
*/
|
||||
output wire [DATA_WIDTH-1:0] m_axis_tdata,
|
||||
output wire m_axis_tvalid,
|
||||
input wire m_axis_tready,
|
||||
|
||||
/*
|
||||
* UART interface
|
||||
*/
|
||||
input wire rxd,
|
||||
output wire txd,
|
||||
|
||||
/*
|
||||
* Status
|
||||
*/
|
||||
output wire tx_busy,
|
||||
output wire rx_busy,
|
||||
output wire rx_overrun_error,
|
||||
output wire rx_frame_error,
|
||||
|
||||
/*
|
||||
* Configuration
|
||||
*/
|
||||
input wire [15:0] prescale
|
||||
|
||||
);
|
||||
|
||||
uart_tx #(
|
||||
.DATA_WIDTH(DATA_WIDTH)
|
||||
)
|
||||
uart_tx_inst (
|
||||
.clk(clk),
|
||||
.rst(rst),
|
||||
// axi input
|
||||
.s_axis_tdata(s_axis_tdata),
|
||||
.s_axis_tvalid(s_axis_tvalid),
|
||||
.s_axis_tready(s_axis_tready),
|
||||
// output
|
||||
.txd(txd),
|
||||
// status
|
||||
.busy(tx_busy),
|
||||
// configuration
|
||||
.prescale(prescale)
|
||||
);
|
||||
|
||||
uart_rx #(
|
||||
.DATA_WIDTH(DATA_WIDTH)
|
||||
)
|
||||
uart_rx_inst (
|
||||
.clk(clk),
|
||||
.rst(rst),
|
||||
// axi output
|
||||
.m_axis_tdata(m_axis_tdata),
|
||||
.m_axis_tvalid(m_axis_tvalid),
|
||||
.m_axis_tready(m_axis_tready),
|
||||
// input
|
||||
.rxd(rxd),
|
||||
// status
|
||||
.busy(rx_busy),
|
||||
.overrun_error(rx_overrun_error),
|
||||
.frame_error(rx_frame_error),
|
||||
// configuration
|
||||
.prescale(prescale)
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2014-2017 Alex Forencich
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// Language: Verilog 2001
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* AXI4-Stream UART
|
||||
*/
|
||||
module uart_rx #
|
||||
(
|
||||
parameter DATA_WIDTH = 8
|
||||
)
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* AXI output
|
||||
*/
|
||||
output wire [DATA_WIDTH-1:0] m_axis_tdata,
|
||||
output wire m_axis_tvalid,
|
||||
input wire m_axis_tready,
|
||||
|
||||
/*
|
||||
* UART interface
|
||||
*/
|
||||
input wire rxd,
|
||||
|
||||
/*
|
||||
* Status
|
||||
*/
|
||||
output wire busy,
|
||||
output wire overrun_error,
|
||||
output wire frame_error,
|
||||
|
||||
/*
|
||||
* Configuration
|
||||
*/
|
||||
input wire [15:0] prescale
|
||||
|
||||
);
|
||||
|
||||
reg [DATA_WIDTH-1:0] m_axis_tdata_reg = 0;
|
||||
reg m_axis_tvalid_reg = 0;
|
||||
|
||||
reg rxd_reg = 1;
|
||||
|
||||
reg busy_reg = 0;
|
||||
reg overrun_error_reg = 0;
|
||||
reg frame_error_reg = 0;
|
||||
|
||||
reg [DATA_WIDTH-1:0] data_reg = 0;
|
||||
reg [18:0] prescale_reg = 0;
|
||||
reg [3:0] bit_cnt = 0;
|
||||
|
||||
assign m_axis_tdata = m_axis_tdata_reg;
|
||||
assign m_axis_tvalid = m_axis_tvalid_reg;
|
||||
|
||||
assign busy = busy_reg;
|
||||
assign overrun_error = overrun_error_reg;
|
||||
assign frame_error = frame_error_reg;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
m_axis_tdata_reg <= 0;
|
||||
m_axis_tvalid_reg <= 0;
|
||||
rxd_reg <= 1;
|
||||
prescale_reg <= 0;
|
||||
bit_cnt <= 0;
|
||||
busy_reg <= 0;
|
||||
overrun_error_reg <= 0;
|
||||
frame_error_reg <= 0;
|
||||
end else begin
|
||||
rxd_reg <= rxd;
|
||||
overrun_error_reg <= 0;
|
||||
frame_error_reg <= 0;
|
||||
|
||||
if (m_axis_tvalid && m_axis_tready) begin
|
||||
m_axis_tvalid_reg <= 0;
|
||||
end
|
||||
|
||||
if (prescale_reg > 0) begin
|
||||
prescale_reg <= prescale_reg - 1;
|
||||
end else if (bit_cnt > 0) begin
|
||||
if (bit_cnt > DATA_WIDTH+1) begin
|
||||
if (!rxd_reg) begin
|
||||
bit_cnt <= bit_cnt - 1;
|
||||
prescale_reg <= (prescale << 3)-1;
|
||||
end else begin
|
||||
bit_cnt <= 0;
|
||||
prescale_reg <= 0;
|
||||
end
|
||||
end else if (bit_cnt > 1) begin
|
||||
bit_cnt <= bit_cnt - 1;
|
||||
prescale_reg <= (prescale << 3)-1;
|
||||
data_reg <= {rxd_reg, data_reg[DATA_WIDTH-1:1]};
|
||||
end else if (bit_cnt == 1) begin
|
||||
bit_cnt <= bit_cnt - 1;
|
||||
if (rxd_reg) begin
|
||||
m_axis_tdata_reg <= data_reg;
|
||||
m_axis_tvalid_reg <= 1;
|
||||
overrun_error_reg <= m_axis_tvalid_reg;
|
||||
end else begin
|
||||
frame_error_reg <= 1;
|
||||
end
|
||||
end
|
||||
end else begin
|
||||
busy_reg <= 0;
|
||||
if (!rxd_reg) begin
|
||||
prescale_reg <= (prescale << 2)-2;
|
||||
bit_cnt <= DATA_WIDTH+2;
|
||||
data_reg <= 0;
|
||||
busy_reg <= 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2014-2017 Alex Forencich
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// Language: Verilog 2001
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* AXI4-Stream UART
|
||||
*/
|
||||
module uart_tx #
|
||||
(
|
||||
parameter DATA_WIDTH = 8
|
||||
)
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* AXI input
|
||||
*/
|
||||
input wire [DATA_WIDTH-1:0] s_axis_tdata,
|
||||
input wire s_axis_tvalid,
|
||||
output wire s_axis_tready,
|
||||
|
||||
/*
|
||||
* UART interface
|
||||
*/
|
||||
output wire txd,
|
||||
|
||||
/*
|
||||
* Status
|
||||
*/
|
||||
output wire busy,
|
||||
|
||||
/*
|
||||
* Configuration
|
||||
*/
|
||||
input wire [15:0] prescale
|
||||
);
|
||||
|
||||
reg s_axis_tready_reg = 0;
|
||||
|
||||
reg txd_reg = 1;
|
||||
|
||||
reg busy_reg = 0;
|
||||
|
||||
reg [DATA_WIDTH:0] data_reg = 0;
|
||||
reg [18:0] prescale_reg = 0;
|
||||
reg [3:0] bit_cnt = 0;
|
||||
|
||||
assign s_axis_tready = s_axis_tready_reg;
|
||||
assign txd = txd_reg;
|
||||
|
||||
assign busy = busy_reg;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
s_axis_tready_reg <= 0;
|
||||
txd_reg <= 1;
|
||||
prescale_reg <= 0;
|
||||
bit_cnt <= 0;
|
||||
busy_reg <= 0;
|
||||
end else begin
|
||||
if (prescale_reg > 0) begin
|
||||
s_axis_tready_reg <= 0;
|
||||
prescale_reg <= prescale_reg - 1;
|
||||
end else if (bit_cnt == 0) begin
|
||||
s_axis_tready_reg <= 1;
|
||||
busy_reg <= 0;
|
||||
|
||||
if (s_axis_tvalid) begin
|
||||
s_axis_tready_reg <= !s_axis_tready_reg;
|
||||
prescale_reg <= (prescale << 3)-1;
|
||||
bit_cnt <= DATA_WIDTH+1;
|
||||
data_reg <= {1'b1, s_axis_tdata};
|
||||
txd_reg <= 0;
|
||||
busy_reg <= 1;
|
||||
end
|
||||
end else begin
|
||||
if (bit_cnt > 1) begin
|
||||
bit_cnt <= bit_cnt - 1;
|
||||
prescale_reg <= (prescale << 3)-1;
|
||||
{data_reg, txd_reg} <= {1'b0, data_reg};
|
||||
end else if (bit_cnt == 1) begin
|
||||
bit_cnt <= bit_cnt - 1;
|
||||
prescale_reg <= (prescale << 3);
|
||||
txd_reg <= 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
Loading…
Reference in New Issue