From b1156e21637510fa7dfb2aff357cb1e21e08af5e Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sun, 18 Dec 2016 10:37:05 +0000 Subject: [PATCH] [JUART] - better BAUD_DIV git-svn-id: http://moon:8086/svn/vhdl/trunk@1345 cc03376c-175c-47c8-b038-4cd826a8556b --- lib/uart/sim/tb_juart_tx_rx.wdo | 2 +- lib/uart/tb_juart_tx_rx.vhd | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/uart/sim/tb_juart_tx_rx.wdo b/lib/uart/sim/tb_juart_tx_rx.wdo index 60b405c..a07db2d 100644 --- a/lib/uart/sim/tb_juart_tx_rx.wdo +++ b/lib/uart/sim/tb_juart_tx_rx.wdo @@ -11,7 +11,7 @@ add wave -noupdate -format Logic /tb_juart_tx_rx/serial_in add wave -noupdate -format Logic /tb_juart_tx_rx/data_strobe add wave -noupdate -format Literal -radix hexadecimal /tb_juart_tx_rx/data_out add wave -noupdate -format Literal -radix hexadecimal /tb_juart_tx_rx/data_rx -add wave -noupdate -format Literal /tb_juart_tx_rx/data_tx +add wave -noupdate -format Literal -radix hexadecimal /tb_juart_tx_rx/data_tx TreeUpdate [SetDefaultTree] WaveRestoreCursors {{Cursor 1} {0 ps} 0} configure wave -namecolwidth 150 diff --git a/lib/uart/tb_juart_tx_rx.vhd b/lib/uart/tb_juart_tx_rx.vhd index a7c3134..3316d6e 100644 --- a/lib/uart/tb_juart_tx_rx.vhd +++ b/lib/uart/tb_juart_tx_rx.vhd @@ -32,6 +32,7 @@ architecture behave of tb_juart_tx_rx is -- Number of user data words for simulation constant CLK_PERIOD : time := 10 ns; + constant BAUD_DIV : natural := 2; -- Common signal rst : std_logic := '1'; @@ -51,7 +52,7 @@ architecture behave of tb_juart_tx_rx is -- Others signal baud_count : unsigned(15 downto 0); - signal baudrate : unsigned(15 downto 0) := X"0001"; + signal baud_reg : unsigned(15 downto 0) := to_unsigned(BAUD_DIV-1, baud_count'length); signal data_rx : unsigned(7 downto 0); signal data_tx : unsigned(7 downto 0); @@ -108,7 +109,7 @@ begin en_16_x_baud <= '0'; if rst = '1' then baud_count <= (others => '0'); - elsif baud_count = baudrate then + elsif baud_count = baud_reg then baud_count <= (others => '0'); en_16_x_baud <= '1'; else