Skip to content

Commit ae36de0

Browse files
committed
Bugfixed simulation script and testbench file.
1 parent cc931ff commit ae36de0

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

sim/sim.tcl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@
77
# WEBSITE: https://github.com/jakubcabal/uart-for-fpga
88
#-------------------------------------------------------------------------------
99

10+
# Create work library
11+
vlib work
12+
1013
# Compile VHDL files
11-
vcom ../rtl/comp/uart_parity.vhd
12-
vcom ../rtl/comp/uart_tx.vhd
13-
vcom ../rtl/comp/uart_rx.vhd
14-
vcom ../rtl/uart.vhd
15-
vcom ./uart_tb.vhd
14+
vcom -93 ../rtl/comp/uart_parity.vhd
15+
vcom -93 ../rtl/comp/uart_tx.vhd
16+
vcom -93 ../rtl/comp/uart_rx.vhd
17+
vcom -93 ../rtl/uart.vhd
18+
vcom -93 ./uart_tb.vhd
1619

1720
# Load testbench
1821
vsim work.uart_tb
1922

2023
# Setup and start simulation
2124
add wave *
2225
#add wave sim:/uart_tb/utt/*
23-
run 10 us
26+
run 200 us

sim/uart_tb.vhd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ begin
4949
-- USER DATA INPUT INTERFACE
5050
DIN => din,
5151
DIN_VLD => din_vld,
52-
BUSY => busy
52+
BUSY => busy,
5353
-- USER DATA OUTPUT INTERFACE
5454
DOUT => dout,
5555
DOUT_VLD => dout_vld,
56-
FRAME_ERROR => frame_error,
56+
FRAME_ERROR => frame_error
5757
);
5858

5959
clk_process : process
@@ -67,8 +67,9 @@ begin
6767
rst_gen_p : process
6868
begin
6969
RST <= '1';
70-
wait for 100 ns;
70+
wait for clk_period*3;
7171
RST <= '0';
72+
wait;
7273
end process;
7374

7475
test_rx_uart : process
@@ -106,12 +107,12 @@ begin
106107

107108
test_tx_uart : process
108109
begin
110+
din <= data_value;
109111
din_vld <= '0';
110112

111113
wait until RST = '0';
112114
wait until rising_edge(CLK);
113115
din_vld <= '1';
114-
din <= data_value;
115116

116117
wait until rising_edge(CLK);
117118
din_vld <= '0';

0 commit comments

Comments
 (0)