diff options
Diffstat (limited to 'doc/using/UART_srcs/tx')
-rw-r--r-- | doc/using/UART_srcs/tx/BlockTX.png | bin | 0 -> 21655 bytes | |||
-rw-r--r-- | doc/using/UART_srcs/tx/TX.ghw | bin | 0 -> 349969 bytes | |||
-rw-r--r-- | doc/using/UART_srcs/tx/TX.svg | 395 | ||||
-rw-r--r-- | doc/using/UART_srcs/tx/TX_simple.png | bin | 0 -> 63700 bytes | |||
-rw-r--r-- | doc/using/UART_srcs/tx/UART_TX_8N1.vhd | 162 | ||||
-rw-r--r-- | doc/using/UART_srcs/tx/makefile | 8 | ||||
-rw-r--r-- | doc/using/UART_srcs/tx/path6054.png | bin | 0 -> 74166 bytes | |||
-rw-r--r-- | doc/using/UART_srcs/tx/tb_UART_TX_8N1.vhd | 95 | ||||
-rw-r--r-- | doc/using/UART_srcs/tx/tx.gtkw | 33 |
9 files changed, 693 insertions, 0 deletions
diff --git a/doc/using/UART_srcs/tx/BlockTX.png b/doc/using/UART_srcs/tx/BlockTX.png Binary files differnew file mode 100644 index 000000000..9031bb2f3 --- /dev/null +++ b/doc/using/UART_srcs/tx/BlockTX.png diff --git a/doc/using/UART_srcs/tx/TX.ghw b/doc/using/UART_srcs/tx/TX.ghw Binary files differnew file mode 100644 index 000000000..1af3cfed0 --- /dev/null +++ b/doc/using/UART_srcs/tx/TX.ghw diff --git a/doc/using/UART_srcs/tx/TX.svg b/doc/using/UART_srcs/tx/TX.svg new file mode 100644 index 000000000..35040d850 --- /dev/null +++ b/doc/using/UART_srcs/tx/TX.svg @@ -0,0 +1,395 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="TX.svg" + inkscape:export-filename="/home/red/artikel_uart/tx/BlockTX.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + <defs + id="defs4"> + <marker + inkscape:stockid="Arrow2Lend" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow2Lend" + style="overflow:visible;"> + <path + id="path3823" + style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + transform="scale(1.1) rotate(180) translate(1,0)" /> + </marker> + <marker + inkscape:stockid="Arrow1Mend" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow1Mend" + style="overflow:visible;"> + <path + id="path3811" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;" + transform="scale(0.4) rotate(180) translate(10,0)" /> + </marker> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.98994949" + inkscape:cx="322.39263" + inkscape:cy="657.39598" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1385" + inkscape:window-height="898" + inkscape:window-x="498" + inkscape:window-y="27" + inkscape:window-maximized="0" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="m 513.8103,332.36218 c 158.3947,0 158.3947,0 158.3947,0" + id="path4616" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 302.99003,332.36218 c 368.43852,0 368.43852,0 368.43852,0" + id="path3756" + inkscape:connector-curvature="0" /> + <path + style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" + d="m 473.12814,282.66415 61.61891,27.14285 0.71428,104.56593 -62.33319,27.85714 z" + id="rect2985" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="471.74121" + y="524.05237" + id="text3758" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3760" + x="471.74121" + y="524.05237">Idle</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="526.28943" + y="528.09302" + id="text3762" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3764" + x="526.28943" + y="528.09302">Start</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="557.60413" + y="558.39758" + id="text3766" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3768" + x="557.60413" + y="558.39758">Data0</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="420.22345" + y="581.6311" + id="text3770" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3772" + x="420.22345" + y="581.6311">Data7</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="423.25394" + y="548.29602" + id="text3774" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3776" + x="423.25394" + y="548.29602">Stop</tspan></text> + <text + sodipodi:linespacing="125%" + id="text3778" + y="582.6413" + x="566.6955" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + xml:space="preserve"><tspan + y="582.6413" + x="566.6955" + id="tspan3780" + sodipodi:role="line">Data1</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="546.43152" + y="612.94586" + id="text3782" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3784" + x="546.43152" + y="612.94586">Data2</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="472.75137" + y="562.43817" + id="text3786" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3788" + x="472.75137" + y="562.43817" + style="font-size:20px">State</tspan><tspan + sodipodi:role="line" + x="472.75137" + y="587.43817" + id="tspan3790" + style="font-size:20px">Machine</tspan></text> + <rect + style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="rect3792" + width="235.36554" + height="146.47212" + x="400.02042" + y="493.88995" + ry="73.236061" + rx="73.236061" /> + <path + style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend);stroke-miterlimit:4;stroke-dasharray:1,4;stroke-dashoffset:0" + d="m 537.40116,614.96613 c -72.73099,-1.01015 -86.87312,8.08122 -94.95435,-9.09137 -8.08122,-17.1726 -11.05566,-23.36658 -11.05566,-23.36658" + id="path3796" + inkscape:connector-curvature="0" + sodipodi:nodetypes="csc" /> + <rect + style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4428" + width="114.28571" + height="219.28572" + x="195.57143" + y="273.79074" + rx="0" + ry="0" /> + <path + inkscape:connector-curvature="0" + id="path4430" + d="m 313.29502,332.36218 c 158.3947,0 158.3947,0 158.3947,0" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" /> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="617.70831" + y="324.54727" + id="text4618" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4620" + x="617.70831" + y="324.54727">TX</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 510.12704,424.0473 c 0,68.1853 0,68.1853 0,68.1853" + id="path4622" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 309.10668,478.09046 98.58101,56.91577" + id="path4624" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="201.54575" + y="466.97879" + id="text4626" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4628" + x="201.54575" + y="466.97879">circular buffer</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="213.1422" + y="310.91022" + id="text4630" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4632" + x="213.1422" + y="310.91022">FIFO</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="482.34784" + y="334.6488" + id="text4634" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4636" + x="482.34784" + y="334.6488">MUX</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="m 448.65546,384.36218 c 23.03426,0 23.03426,0 23.03426,0" + id="path4638" + inkscape:connector-curvature="0" /> + <path + inkscape:connector-curvature="0" + id="path4640" + d="m 448.65546,302.31647 c 23.03426,0 23.03426,0 23.03426,0" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" /> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="430.83005" + y="388.69196" + id="text4642" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4644" + x="430.83005" + y="388.69196">'1'</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="429.31482" + y="307.87976" + id="text4646" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4648" + x="429.31482" + y="307.87976">'0'</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="m 144.39149,302.31647 49.29823,0" + id="path4650" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="147.48227" + y="294.74777" + id="text4652" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4654" + x="147.48227" + y="294.74777">WR</tspan></text> + <text + xml:space="preserve" + style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="147.98735" + y="333.13358" + id="text4656" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4658" + x="147.98735" + y="333.13358">DATA</tspan></text> + <path + inkscape:connector-curvature="0" + id="path4660" + d="m 141.36104,344.31647 52.32868,0" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 394.96964,322.02189 -7.07106,18.18274" + id="path4199" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path4201" + d="m 170.71577,335.15387 -7.07106,18.18274" + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="382.84781" + y="356.36707" + id="text4203" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4205" + x="382.84781" + y="356.36707">8</tspan></text> + <text + sodipodi:linespacing="125%" + id="text4207" + y="366.4686" + x="158.59395" + style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + y="366.4686" + x="158.59395" + id="tspan4209" + sodipodi:role="line">8</tspan></text> + <text + sodipodi:linespacing="125%" + id="text4211" + y="410.73257" + x="139.36044" + style="font-style:normal;font-weight:normal;font-size:16px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none" + xml:space="preserve"><tspan + y="410.73257" + x="139.36044" + id="tspan4213" + sodipodi:role="line">WR_EN</tspan></text> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path4207" + d="m 195.01774,420.31647 -49.29823,0" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" /> + </g> +</svg> diff --git a/doc/using/UART_srcs/tx/TX_simple.png b/doc/using/UART_srcs/tx/TX_simple.png Binary files differnew file mode 100644 index 000000000..cdf10e0c6 --- /dev/null +++ b/doc/using/UART_srcs/tx/TX_simple.png diff --git a/doc/using/UART_srcs/tx/UART_TX_8N1.vhd b/doc/using/UART_srcs/tx/UART_TX_8N1.vhd new file mode 100644 index 000000000..c8fd80b4a --- /dev/null +++ b/doc/using/UART_srcs/tx/UART_TX_8N1.vhd @@ -0,0 +1,162 @@ +-- UART_TX_8N1.vhd +---------------------------------------------------------------------- +library IEEE; +use IEEE.STD_LOGIC_1164.all; +use ieee.numeric_std.all; + +--UART transmiter without parity + +entity UART_8N1_TX is + generic( + clk_freq : integer; + baudrate : integer; + addr_depth : integer:=5); + port( + clk : in std_logic; + reset : in std_logic; + --8bit interface + wdata : in std_logic_vector(7 downto 0); + wr : in std_logic; + wr_en : out std_logic; + + --physical wire + tx : out std_logic); +end; + + +architecture Behavioral of UART_8N1_TX is +--FSM + type state_type is (idle, start, data0, data1, data2, data3, data4, + data5, data6, data7, stop); + + signal state : state_type := idle; + signal nextstate : state_type := idle; + + --FIFO + type RAM is array (0 to (2**(addr_depth)-1)) of std_logic_vector (7 downto 0); + signal fifo : RAM; + signal nextwrite : unsigned((addr_depth-1) downto 0); + signal nextread : unsigned((addr_depth-1) downto 0); + + signal send_empty: std_logic; + + --output + signal data_tx : std_logic_vector (7 downto 0); + constant tick : integer := (clk_freq/baudrate); + signal tick_counter : integer range 0 to (tick+1); + +begin + + wr_en <= '0' when (nextwrite+1 = nextread) else '1'; + send_empty<='1' when nextwrite=nextread else '0'; + + process(clk) + begin + if rising_edge(clk) then + if reset = '1' then + nextread <= (others => '0'); + elsif state = stop and nextstate = idle then + nextread <= nextread+1; + end if; + end if; + end process; + + process(clk) + begin + if rising_edge(clk) then + state <= nextstate; + end if; + end process; + + process(clk) + begin + if rising_edge(clk) then + if reset = '1' then + nextwrite <= (others => '0'); + elsif wr = '1' then + fifo(to_integer(nextwrite)) <= wdata; + nextwrite <= nextwrite+1; + + end if; + end if; + end process; + + + data_tx <= fifo(to_integer(nextread)); + + process(clk) + begin + if rising_edge(clk) then + if state = idle then + if nextwrite /= nextread then + nextstate <= start; + tick_counter <= 0; + tx <= '0'; + else + tx <= '1'; + end if; + else + if tick_counter = tick then + tick_counter <= 0; + else + tick_counter <= tick_counter + 1; + end if; + end if; + if tick_counter = tick then + if state = start then + nextstate <= data0; + tx <= data_tx(0); + end if; + + if state = data0 then + nextstate <= data1; + tx <= data_tx(1); + end if; + + if state = data1 then + nextstate <= data2; + tx <= data_tx(2); + end if; + + if state = data2 then + nextstate <= data3; + tx <= data_tx(3); + end if; + if state = data3 then + nextstate <= data4; + tx <= data_tx(4); + end if; + if state = data4 then + nextstate <= data5; + tx <= data_tx(5); + end if; + if state = data5 then + nextstate <= data6; + tx <= data_tx(6); + end if; + if state = data6 then + nextstate <= data7; + tx <= data_tx(7); + end if; + if state = data7 then + nextstate <= stop; + tx <= '1'; + end if; + if state = stop then + nextstate <= idle; + tx <= '1'; + end if; + end if; + + if reset = '1' then + tick_counter <= 0; + tx <= '1'; + nextstate <= idle; + end if; + end if; + + end process; + + +end Behavioral; + diff --git a/doc/using/UART_srcs/tx/makefile b/doc/using/UART_srcs/tx/makefile new file mode 100644 index 000000000..83168f2f1 --- /dev/null +++ b/doc/using/UART_srcs/tx/makefile @@ -0,0 +1,8 @@ + +all: + ghdl -i *.vhd + ghdl -m tb_UART_TX_8N1 + ghdl -r tb_UART_TX_8N1 --stop-time=200us --wave=TX.ghw + +view: + gtkwave TX.ghw diff --git a/doc/using/UART_srcs/tx/path6054.png b/doc/using/UART_srcs/tx/path6054.png Binary files differnew file mode 100644 index 000000000..d2c657243 --- /dev/null +++ b/doc/using/UART_srcs/tx/path6054.png diff --git a/doc/using/UART_srcs/tx/tb_UART_TX_8N1.vhd b/doc/using/UART_srcs/tx/tb_UART_TX_8N1.vhd new file mode 100644 index 000000000..a485a404a --- /dev/null +++ b/doc/using/UART_srcs/tx/tb_UART_TX_8N1.vhd @@ -0,0 +1,95 @@ +-- tb_UART_TX_8N1.vhd +---------------------------------------------------------------------- +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity tb_UART_TX_8N1 is +end tb_UART_TX_8N1; + +architecture behavior of tb_UART_TX_8N1 is + + --Inputs + signal board_clk : std_logic := '0'; + signal reset : std_logic := '0'; + signal send_data : std_logic_vector (7 downto 0); + signal wr : std_logic := '0'; + signal tx : std_logic; + + -- Component Declaration for the Unit Under Test (UUT) + component UART_8N1_TX is + generic( + clk_freq : integer; + baudrate : integer; + addr_depth : integer:=5); + port( + clk : in std_logic; + reset : in std_logic; + --8bit interface + wdata : in std_logic_vector(7 downto 0); + wr : in std_logic; + wr_en : out std_logic; + + --physical wire + tx : out std_logic); +end component; + + constant board_clk_period : time := 10 ns; + constant board_clk_freq: integer :=100E6; --100MHz + +begin + + -- Instantiate the Unit Under Test (UUT) +UART_TX: UART_8N1_TX + generic map( + clk_freq => board_clk_freq, + baudrate => 115200 + -- addr_depth => use predefined + ) + port map( + clk => board_clk, + reset => reset, + + wdata => send_data, + wr => wr, + wr_en => open, + + tx => tx + ); + + -- Clock process definitions + board_clk_process : process + begin + board_clk <= '0'; + wait for board_clk_period/2; + board_clk <= '1'; + wait for board_clk_period/2; + end process; + + + -- Stimulus process + stim_proc : process + begin + reset <= '1'; + + wait for 15 us; + reset <='0'; + send_data<=X"A0"; + wait until rising_edge(board_clk); + wr<= '1'; + + wait until rising_edge(board_clk); + wr<= '0'; + + wait for 5 us; + + wait until rising_edge(board_clk); + wr<= '1'; + send_data<=X"B1"; + + wait until rising_edge(board_clk); + wr<= '0'; + wait; + end process; + + end; diff --git a/doc/using/UART_srcs/tx/tx.gtkw b/doc/using/UART_srcs/tx/tx.gtkw new file mode 100644 index 000000000..92e8cd730 --- /dev/null +++ b/doc/using/UART_srcs/tx/tx.gtkw @@ -0,0 +1,33 @@ +[*] +[*] GTKWave Analyzer v3.3.67 (w)1999-2015 BSI +[*] Fri Dec 16 19:12:23 2016 +[*] +[dumpfile] "/home/red/artikel_uart/tx/TX.ghw" +[dumpfile_mtime] "Fri Dec 16 19:08:11 2016" +[dumpfile_size] 349946 +[savefile] "/home/red/artikel_uart/tx/tx.gtkw" +[timestart] 0 +[size] 1920 1016 +[pos] -83 -83 +*-35.000000 106965000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 +[treeopen] top. +[treeopen] top.tb_uart_tx_8n1. +[treeopen] top.tb_uart_tx_8n1.uart_tx. +[sst_width] 218 +[signals_width] 142 +[sst_expanded] 1 +[sst_vpaned_height] 215 +@28 +top.tb_uart_tx_8n1.board_clk +top.tb_uart_tx_8n1.reset +[color] 5 +top.tb_uart_tx_8n1.wr +@22 +#{top.tb_uart_tx_8n1.send_data[7:0]} top.tb_uart_tx_8n1.send_data[7] top.tb_uart_tx_8n1.send_data[6] top.tb_uart_tx_8n1.send_data[5] top.tb_uart_tx_8n1.send_data[4] top.tb_uart_tx_8n1.send_data[3] top.tb_uart_tx_8n1.send_data[2] top.tb_uart_tx_8n1.send_data[1] top.tb_uart_tx_8n1.send_data[0] +@200 +-FIFO_Control +@22 +#{top.tb_uart_tx_8n1.uart_tx.nextread[4:0]} top.tb_uart_tx_8n1.uart_tx.nextread[4] top.tb_uart_tx_8n1.uart_tx.nextread[3] top.tb_uart_tx_8n1.uart_tx.nextread[2] top.tb_uart_tx_8n1.uart_tx.nextread[1] top.tb_uart_tx_8n1.uart_tx.nextread[0] +#{top.tb_uart_tx_8n1.uart_tx.nextwrite[4:0]} top.tb_uart_tx_8n1.uart_tx.nextwrite[4] top.tb_uart_tx_8n1.uart_tx.nextwrite[3] top.tb_uart_tx_8n1.uart_tx.nextwrite[2] top.tb_uart_tx_8n1.uart_tx.nextwrite[1] top.tb_uart_tx_8n1.uart_tx.nextwrite[0] +[pattern_trace] 1 +[pattern_trace] 0 |