Browse Source

Change baud rate to 9600 and simulate two symbols

Jonatan Gezelius 4 năm trước cách đây
mục cha
commit
5d83e8f1e2
1 tập tin đã thay đổi với 7 bổ sung5 xóa
  1. 7 5
      uart_module/testbench/async_8n1_tx_tb.vhd

+ 7 - 5
uart_module/testbench/async_8n1_tx_tb.vhd

@@ -9,7 +9,7 @@ end entity;
 architecture beh of async_8n1_tx_tb is
 	component generic_prescaler is
 		generic (
-			prescaler_bits : integer := 8
+			prescaler_bits : integer := 13
 		);
 		port(
 			clk : in std_logic;
@@ -51,6 +51,8 @@ architecture beh of async_8n1_tx_tb is
 	constant period : time := 1000 / freq * 1 ns;
 	constant half_period : time := period / 2;
 	signal num_rising_edges : integer := 0;
+	
+	constant simulation_periods : integer := 5155*21;
 
 	signal clock : std_logic := '0';
 	signal enable : std_logic;
@@ -58,7 +60,7 @@ architecture beh of async_8n1_tx_tb is
 
 	signal prescaled_clk_en : std_logic;
 	
-	constant prescaler_value : integer := 5;
+	constant prescaler_value : integer := 5154;
 	constant prescaler_num_bits : integer := integer(ceil(log2(real(prescaler_value))));
 
 	signal running : boolean := true;
@@ -75,7 +77,7 @@ architecture beh of async_8n1_tx_tb is
 	
 begin
 	running <= true,
-			   false after 500 * period;
+			   false after simulation_periods * period;
 	
 	reset <= '0',
 			 '1' after 2 * period,
@@ -112,7 +114,7 @@ begin
 		port map(
 			clk => clock,
 			rst => reset,
-			en => '1', --prescaled_clk_en,
+			en => prescaled_clk_en,
 			wr => wr,
 			data_in => tx_char,
 			rdy => rdy1,
@@ -123,7 +125,7 @@ begin
 		port map(
 			clk => clock,
 			rst => reset,
-			en => '1', --prescaled_clk_en,
+			en => prescaled_clk_en,
 			wr => wr,
 			data_in => tx_char,
 			rdy => rdy2,