Hello,
I'm quite new to VHDL and trying to create a simple UART transmission in
VHDL code.
This is my code:
1 | entity UART is
|
2 | port ( din : in bit_vector( 7 downto 0) ;
|
3 | send : in std_logic ;
|
4 | tx : out bit ) ;
|
5 | end UART;
|
6 |
|
7 | architecture arc_UART of UART is
|
8 | begin
|
9 | process
|
10 | constant bit_time : time := 8680 ns ; -- 1/115200 [baud]
|
11 | begin
|
12 | tx <= '1' ; -- idle state
|
13 | wait until falling_edge(send) ; -- wait until send
|
14 | tx <= '0' ; wait for bit_time ; -- start bit
|
15 | for i in 0 to 7 loop
|
16 | tx <= din(i) ; wait for bit_time ; -- send 8 data bits
|
17 | end loop ;
|
18 | tx <= '1' ; wait for bit_time ; -- stop bit
|
19 | end process;
|
20 | end arc_UART;
|
But the problem is that when I run a Model-sim simulation, it doesn't
work as expected.
What could be the problem here?
Thank you