Skip to content

Commit 6e1fb07

Browse files
committed
[MAINTENANCE]: Small code clean and optimization
1 parent 6cf842a commit 6e1fb07

File tree

6 files changed

+12
-25
lines changed

6 files changed

+12
-25
lines changed

rtl/comp/uart_clk_div.vhd

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ begin
5555
div_mark_p : process (CLK)
5656
begin
5757
if (rising_edge(CLK)) then
58-
if (RST = '1') then
59-
DIV_MARK <= '0';
60-
else
61-
DIV_MARK <= ENABLE and clk_div_cnt_mark;
62-
end if;
58+
DIV_MARK <= ENABLE and clk_div_cnt_mark;
6359
end if;
6460
end process;
6561

rtl/comp/uart_debouncer.vhd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
--------------------------------------------------------------------------------
22
-- PROJECT: SIMPLE UART FOR FPGA
33
--------------------------------------------------------------------------------
4-
-- MODULE: UART DEBOUNCER
54
-- AUTHORS: Jakub Cabal <jakubcabal@gmail.com>
65
-- LICENSE: The MIT License (MIT), please read LICENSE file
76
-- WEBSITE: https://github.com/jakubcabal/uart-for-fpga
@@ -22,7 +21,7 @@ entity UART_DEBOUNCER is
2221
DEB_IN : in std_logic; -- input of signal from outside FPGA
2322
DEB_OUT : out std_logic -- output of debounced (filtered) signal
2423
);
25-
end UART_DEBOUNCER;
24+
end entity;
2625

2726
architecture RTL of UART_DEBOUNCER is
2827

@@ -76,4 +75,4 @@ begin
7675
end if;
7776
end process;
7877

79-
end RTL;
78+
end architecture;

rtl/comp/uart_parity.vhd

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
--------------------------------------------------------------------------------
22
-- PROJECT: SIMPLE UART FOR FPGA
33
--------------------------------------------------------------------------------
4-
-- MODULE: UART PARITY BIT GENERATOR
54
-- AUTHORS: Jakub Cabal <jakubcabal@gmail.com>
65
-- LICENSE: The MIT License (MIT), please read LICENSE file
76
-- WEBSITE: https://github.com/jakubcabal/uart-for-fpga
@@ -20,9 +19,9 @@ entity UART_PARITY is
2019
DATA_IN : in std_logic_vector(DATA_WIDTH-1 downto 0);
2120
PARITY_OUT : out std_logic
2221
);
23-
end UART_PARITY;
22+
end entity;
2423

25-
architecture FULL of UART_PARITY is
24+
architecture RTL of UART_PARITY is
2625

2726
begin
2827

@@ -31,7 +30,6 @@ begin
3130
-- -------------------------------------------------------------------------
3231

3332
even_parity_g : if (PARITY_TYPE = "even") generate
34-
3533
process (DATA_IN)
3634
variable parity_temp : std_logic;
3735
begin
@@ -41,11 +39,9 @@ begin
4139
end loop;
4240
PARITY_OUT <= parity_temp;
4341
end process;
44-
4542
end generate;
4643

4744
odd_parity_g : if (PARITY_TYPE = "odd") generate
48-
4945
process (DATA_IN)
5046
variable parity_temp : std_logic;
5147
begin
@@ -55,19 +51,14 @@ begin
5551
end loop;
5652
PARITY_OUT <= parity_temp;
5753
end process;
58-
5954
end generate;
6055

6156
mark_parity_g : if (PARITY_TYPE = "mark") generate
62-
6357
PARITY_OUT <= '1';
64-
6558
end generate;
6659

6760
space_parity_g : if (PARITY_TYPE = "space") generate
68-
6961
PARITY_OUT <= '0';
70-
7162
end generate;
7263

73-
end FULL;
64+
end architecture;

rtl/comp/uart_tx.vhd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ entity UART_TX is
2626
DIN_VLD : in std_logic; -- when DIN_VLD = 1, input data (DIN) are valid
2727
DIN_RDY : out std_logic -- when DIN_RDY = 1, transmitter is ready and valid input data will be accepted for transmiting
2828
);
29-
end UART_TX;
29+
end entity;
3030

31-
architecture FULL of UART_TX is
31+
architecture RTL of UART_TX is
3232

3333
signal tx_clk_en : std_logic;
3434
signal tx_clk_div_clr : std_logic;
@@ -250,4 +250,4 @@ begin
250250
end case;
251251
end process;
252252

253-
end FULL;
253+
end architecture;

rtl/uart.vhd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use IEEE.MATH_REAL.ALL;
3333
-- UART loopback example is for CYC1000 board now.
3434
-- Version 1.3 -
3535
-- Added better simulation with automatic checking of transactions.
36+
-- Little code cleaning and code optimization.
3637

3738
entity UART is
3839
Generic (

sim/uart_tb.vhd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use IEEE.NUMERIC_STD.ALL;
1212
use IEEE.MATH_REAL.ALL;
1313

1414
entity UART_TB is
15-
end UART_TB;
15+
end entity;
1616

17-
architecture FULL of UART_TB is
17+
architecture SIM of UART_TB is
1818

1919
signal CLK : std_logic;
2020
signal RST : std_logic;

0 commit comments

Comments
 (0)