Skip to content

Commit f5000c3

Browse files
committed
Update UART loopback, added timing constraints and assignments.
1 parent a0be2fc commit f5000c3

File tree

4 files changed

+55
-27
lines changed

4 files changed

+55
-27
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#-------------------------------------------------------------------------------
2+
# PROJECT: SIMPLE UART FOR FPGA
3+
#-------------------------------------------------------------------------------
4+
# MODULE: CONSTRAINTS FOR EP4CE6 STARTER BOARD
5+
# AUTHORS: Jakub Cabal <[email protected]>
6+
# LICENSE: The MIT License (MIT), please read LICENSE file
7+
# WEBSITE: https://github.com/jakubcabal/uart-for-fpga
8+
#-------------------------------------------------------------------------------
9+
10+
# GLOBAL CONSTRAINTS FOR EP4CE6 STARTER BOARD
11+
12+
set_global_assignment -name FAMILY "Cyclone IV"
13+
set_global_assignment -name DEVICE EP4CE6E22C8
14+
set_global_assignment -name TOP_LEVEL_ENTITY UART_LOOPBACK
15+
16+
# FPGA PINS ASSIGNMENT
17+
18+
set_location_assignment PIN_91 -to CLK
19+
set_location_assignment PIN_25 -to RST
20+
21+
set_location_assignment PIN_85 -to UART_TXD
22+
set_location_assignment PIN_86 -to UART_RXD

example/timing_constraints.sdc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#-------------------------------------------------------------------------------
2+
# PROJECT: SIMPLE UART FOR FPGA
3+
#-------------------------------------------------------------------------------
4+
# MODULE: TIMING CONSTRAINTS
5+
# AUTHORS: Jakub Cabal <[email protected]>
6+
# LICENSE: The MIT License (MIT), please read LICENSE file
7+
# WEBSITE: https://github.com/jakubcabal/uart-for-fpga
8+
#-------------------------------------------------------------------------------
9+
10+
create_clock -name CLK50 -period 20.000 [get_ports {CLK}]

example/uart_loopback.vhd

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- MODULE: UART LOOPBACK EXAMPLE TOP MODULE
55
-- AUTHORS: Jakub Cabal <[email protected]>
66
-- LICENSE: The MIT License (MIT), please read LICENSE file
7-
-- WEBSITE: https://github.com/jakubcabal/uart_for_fpga
7+
-- WEBSITE: https://github.com/jakubcabal/uart-for-fpga
88
--------------------------------------------------------------------------------
99

1010
library IEEE;
@@ -16,52 +16,48 @@ use IEEE.NUMERIC_STD.ALL;
1616

1717
entity UART_LOOPBACK is
1818
Generic (
19-
CLK_FREQ : integer := 50e6; -- set system clock frequency in Hz
20-
BAUD_RATE : integer := 115200; -- baud rate value
21-
PARITY_BIT : string := "none" -- legal values: "none", "even", "odd", "mark", "space"
19+
CLK_FREQ : integer := 50e6; -- set system clock frequency in Hz
20+
BAUD_RATE : integer := 115200; -- baud rate value
21+
PARITY_BIT : string := "none"; -- legal values: "none", "even", "odd", "mark", "space"
22+
USE_DEBOUNCER : boolean := True -- enable/disable debouncer
2223
);
2324
Port (
24-
CLK : in std_logic; -- system clock
25-
RST_N : in std_logic; -- low active synchronous reset
25+
CLK : in std_logic; -- system clock
26+
RST : in std_logic; -- high active synchronous reset
2627
-- UART INTERFACE
27-
UART_TXD : out std_logic;
28-
UART_RXD : in std_logic;
29-
-- DEBUG INTERFACE
30-
BUSY : out std_logic;
31-
FRAME_ERR : out std_logic
28+
UART_TXD : out std_logic;
29+
UART_RXD : in std_logic
3230
);
3331
end UART_LOOPBACK;
3432

3533
architecture FULL of UART_LOOPBACK is
3634

37-
signal data : std_logic_vector(7 downto 0);
38-
signal valid : std_logic;
39-
signal reset : std_logic;
35+
signal data : std_logic_vector(7 downto 0);
36+
signal valid : std_logic;
4037

4138
begin
4239

43-
reset <= not RST_N;
44-
4540
uart_i: entity work.UART
4641
generic map (
47-
CLK_FREQ => CLK_FREQ,
48-
BAUD_RATE => BAUD_RATE,
49-
PARITY_BIT => PARITY_BIT
42+
CLK_FREQ => CLK_FREQ,
43+
BAUD_RATE => BAUD_RATE,
44+
PARITY_BIT => PARITY_BIT,
45+
USE_DEBOUNCER => USE_DEBOUNCER
5046
)
5147
port map (
5248
CLK => CLK,
53-
RST => reset,
49+
RST => RST,
5450
-- UART INTERFACE
5551
UART_TXD => UART_TXD,
5652
UART_RXD => UART_RXD,
5753
-- USER DATA OUTPUT INTERFACE
58-
DATA_OUT => data,
59-
DATA_VLD => valid,
60-
FRAME_ERROR => FRAME_ERR,
54+
DOUT => data,
55+
DOUT_VLD => valid,
56+
FRAME_ERROR => open,
6157
-- USER DATA INPUT INTERFACE
62-
DATA_IN => data,
63-
DATA_SEND => valid,
64-
BUSY => BUSY
58+
DIN => data,
59+
DIN_VLD => valid,
60+
BUSY => open
6561
);
6662

6763
end FULL;

example/uart_loopback_tb.vhd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- MODULE: TESTBANCH OF UART LOOPBACK EXAMPLE TOP MODULE
55
-- AUTHORS: Jakub Cabal <[email protected]>
66
-- LICENSE: The MIT License (MIT), please read LICENSE file
7-
-- WEBSITE: https://github.com/jakubcabal/uart_for_fpga
7+
-- WEBSITE: https://github.com/jakubcabal/uart-for-fpga
88
--------------------------------------------------------------------------------
99

1010
library IEEE;

0 commit comments

Comments
 (0)