diff options
Diffstat (limited to 'doc/using/UART_srcs/vhpi')
-rw-r--r-- | doc/using/UART_srcs/vhpi/Zeichnung.svg | 424 | ||||
-rw-r--r-- | doc/using/UART_srcs/vhpi/makefile | 22 | ||||
-rw-r--r-- | doc/using/UART_srcs/vhpi/tb_tty.vhd | 116 | ||||
-rw-r--r-- | doc/using/UART_srcs/vhpi/terminal.png | bin | 0 -> 18429 bytes | |||
-rw-r--r-- | doc/using/UART_srcs/vhpi/tty.c | 83 | ||||
-rw-r--r-- | doc/using/UART_srcs/vhpi/tty_pkg.vhd | 70 | ||||
-rw-r--r-- | doc/using/UART_srcs/vhpi/zeichnung.png | bin | 0 -> 45158 bytes |
7 files changed, 715 insertions, 0 deletions
diff --git a/doc/using/UART_srcs/vhpi/Zeichnung.svg b/doc/using/UART_srcs/vhpi/Zeichnung.svg new file mode 100644 index 000000000..f984c727b --- /dev/null +++ b/doc/using/UART_srcs/vhpi/Zeichnung.svg @@ -0,0 +1,424 @@ +<?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="297mm" + height="210mm" + viewBox="0 0 1052.3622 744.09448" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="Zeichnung.svg" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/zeichnung.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + <defs + id="defs4"> + <marker + inkscape:stockid="Arrow1Lend" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow1Lend" + style="overflow:visible;" + inkscape:isstock="true"> + <path + id="path4245" + 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.8) rotate(180) translate(12.5,0)" /> + </marker> + <marker + inkscape:stockid="Arrow1Lend" + orient="auto" + refY="0.0" + refX="0.0" + id="marker5517" + style="overflow:visible;" + inkscape:isstock="true"> + <path + id="path5519" + 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:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" + transform="scale(0.8) rotate(180) translate(12.5,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="490.27074" + inkscape:cy="477.90138" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" /> + <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></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Ebene 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-308.26772)"> + <rect + style="opacity:1;fill:#e6e6e6;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4590" + width="700.03564" + height="360.62445" + x="34.654861" + y="362.42804" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" /> + <rect + y="478.54639" + x="260.19949" + height="214.28572" + width="252.68301" + id="rect4154" + style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="313.14285" + y="623.79077" + id="text4136" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4138" + x="313.14285" + y="623.79077">capitalisation</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="113.99998" + y="645.79077" + id="text4140" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4142" + x="113.99998" + y="645.79077">c function</tspan><tspan + sodipodi:role="line" + x="113.99998" + y="677.04077" + id="tspan4530">read_data</tspan></text> + <rect + style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4148" + width="156.59319" + height="70" + x="98.549683" + y="615.50507" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <rect + y="579.50507" + x="296.28574" + height="70" + width="182.85715" + id="rect4150" + style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <rect + style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4152" + width="182.85715" + height="70" + x="520.28577" + y="579.50507" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="390.94702" + y="512.03662" + id="text4168" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4170" + x="390.94702" + y="512.03662">tb_tty.vhd</tspan></text> + <path + inkscape:connector-curvature="0" + id="path4172" + d="m 255.57141,626.64789 40.35714,0" + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 479.57141,626.64789 40.35714,0" + id="path4174" + inkscape:connector-curvature="0" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:17.1706295px;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="-789.13831" + y="242.90793" + id="text4490" + sodipodi:linespacing="125%" + transform="matrix(0,-0.86921859,1.1504586,0,0,0)" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4492" + x="-789.13831" + y="242.90793">8bit parallel</tspan></text> + <text + transform="matrix(0,-0.86921859,1.1504586,0,0,0)" + sodipodi:linespacing="125%" + id="text4494" + y="440.23749" + x="-709.15009" + style="font-style:normal;font-weight:normal;font-size:17.1706295px;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" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + y="440.23749" + x="-709.15009" + id="tspan4496" + sodipodi:role="line">8bit parallel</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="286.33514" + y="505.65875" + id="text4517" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4519" + x="286.33514" + y="505.65875">clk</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="279.11826" + y="531.00616" + id="text4521" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4523" + x="279.11826" + y="531.00616">reset</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="547.81238" + y="610.96613" + id="text4524" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4526" + x="547.81238" + y="610.96613">c function</tspan><tspan + sodipodi:role="line" + x="547.81238" + y="642.21613" + id="tspan4528">write_data</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="651.70575" + y="405.86456" + id="text4592" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4594" + x="651.70575" + y="405.86456">tty.c</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="106.25388" + y="546.13361" + id="text4598" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4600" + x="106.25388" + y="546.13361">c function</tspan><tspan + sodipodi:role="line" + x="106.25388" + y="577.38361" + id="tspan4602">read_enable</tspan></text> + <rect + y="523.50507" + x="98.549683" + height="70" + width="156.59319" + id="rect4604" + style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <text + sodipodi:linespacing="125%" + id="text4606" + y="410.8595" + x="108.23357" + style="font-style:normal;font-weight:normal;font-size:25px;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" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + y="410.8595" + x="108.23357" + id="tspan4608" + sodipodi:role="line">c function</tspan><tspan + id="tspan4610" + y="442.1095" + x="108.23357" + sodipodi:role="line">tty_open</tspan></text> + <rect + style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4612" + width="156.59319" + height="70" + x="98.549683" + y="383.50507" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 255.57141,586.64789 40.35714,0" + id="path4614" + inkscape:connector-curvature="0" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <text + transform="matrix(0,-0.86921859,1.1504586,0,0,0)" + sodipodi:linespacing="125%" + id="text4616" + y="242.90793" + x="-667.19043" + style="font-style:normal;font-weight:normal;font-size:17.1706295px;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" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + y="242.90793" + x="-667.19043" + id="tspan4618" + sodipodi:role="line">rd_en</tspan></text> + <rect + style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4639" + width="168.69548" + height="134.3503" + x="855.59918" + y="397.78336" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="876.81244" + y="422.02701" + id="text4641" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4643" + x="876.81244" + y="422.02701">terminal</tspan></text> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" + d="m 854.58906,427.07778 c 169.70564,0 169.70564,0 169.70564,0" + id="path4645" + inkscape:connector-curvature="0" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:25px;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="865.70074" + y="457.38235" + id="text4647" + sodipodi:linespacing="125%" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><tspan + sodipodi:role="line" + id="tspan4649" + x="865.70074" + y="457.38235">$></tspan></text> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 735.39106,449.30114 c 0,-1.68359 0,-3.36718 0,-5.05077 0,-0.33671 -0.15059,-0.70898 0,-1.01015 0.21295,-0.42592 0.79719,-0.58423 1.01015,-1.01015 0.15058,-0.30117 -0.15059,-0.70898 0,-1.01015 0.21296,-0.42592 0.79719,-0.58424 1.01015,-1.01016 0.15058,-0.30117 -0.15058,-0.70898 0,-1.01015 0.42592,-0.85183 1.59439,-1.16847 2.02031,-2.0203 0.30116,-0.60234 -0.4762,-1.54412 0,-2.02031 2.09004,-2.09004 -0.0817,3.19386 2.0203,-1.01015 0.30117,-0.60234 -0.47619,-1.54412 0,-2.02031 0.2381,-0.23809 0.77206,0.2381 1.01015,0 0.47619,-0.47619 -0.47619,-1.54411 0,-2.0203 0.2381,-0.2381 0.70899,0.15058 1.01016,0 0.42591,-0.21296 0.67343,-0.67344 1.01015,-1.01015 0.33672,-0.33672 0.79719,-0.58424 1.01015,-1.01016 0.15059,-0.30117 -0.15058,-0.70898 0,-1.01015 0.21296,-0.42592 0.67344,-0.67343 1.01015,-1.01015 0.33672,-0.33672 0.58424,-0.7972 1.01016,-1.01015 0.60233,-0.30117 1.54411,0.47619 2.0203,0 0.2381,-0.2381 -0.23809,-0.77206 0,-1.01016 0.2381,-0.23809 0.70898,0.15059 1.01015,0 0.42592,-0.21296 0.58424,-0.79719 1.01016,-1.01015 0.30117,-0.15058 0.77205,0.2381 1.01015,0 0.23809,-0.23809 -0.2381,-0.77206 0,-1.01015 0.23809,-0.2381 0.70898,0.15058 1.01015,0 0.85184,-0.42592 1.16847,-1.59439 2.02031,-2.02031 0.30117,-0.15058 0.70898,0.15059 1.01015,0 0.42592,-0.21296 0.58423,-0.79719 1.01015,-1.01015 0.30742,-0.15371 2.57553,0 3.03046,0 0.52823,0 3.775,-0.13281 4.04061,0 0.42592,0.21296 0.58423,0.79719 1.01015,1.01015 1.07979,0.5399 0.94052,-0.53989 2.02031,0 0.42591,0.21296 0.58423,0.7972 1.01015,1.01016 0.30117,0.15058 0.70898,-0.15059 1.01015,0 0.42592,0.21295 0.58424,0.79719 1.01015,1.01015 0.30117,0.15058 0.70899,-0.15059 1.01016,0 0.99402,0.49701 3.04659,3.5436 4.04061,4.04061 0.60234,0.30117 1.41796,-0.30117 2.0203,0 4.20402,2.102 -1.07989,-0.0697 1.01015,2.0203 0.2381,0.2381 0.70899,-0.15058 1.01016,0 0.19336,0.0967 3.94393,3.84725 4.04061,4.04061 0.15058,0.30117 -0.2381,0.77206 0,1.01016 0.23809,0.23809 0.70898,-0.15059 1.01015,0 1.21218,0.60609 1.81827,2.42436 3.03046,3.03045 0.30117,0.15059 0.70898,-0.15058 1.01015,0 4.20401,2.10201 -1.07989,-0.0697 1.01015,2.02031 0.2381,0.23809 0.70899,-0.15059 1.01016,0 0.42591,0.21296 0.58423,0.79719 1.01015,1.01015 0.30117,0.15059 0.70898,-0.15058 1.01015,0 1.21218,0.60609 1.81827,2.42437 3.03046,3.03046 0.60234,0.30117 1.54411,-0.47619 2.0203,0 0.2381,0.23809 -0.23809,0.77206 0,1.01015 0.47619,0.47619 1.54412,-0.47619 2.02031,0 0.23809,0.2381 -0.2381,0.77206 0,1.01015 0.23809,0.2381 0.70898,-0.15058 1.01015,0 0.42592,0.21296 0.58424,0.7972 1.01015,1.01016 0.30117,0.15058 0.70899,-0.15059 1.01016,0 0.42591,0.21296 0.58423,0.79719 1.01015,1.01015 0.60234,0.30117 1.41796,-0.30117 2.0203,0 0.42592,0.21296 0.58424,0.79719 1.01016,1.01015 0.6349,0.31745 3.4057,-0.31745 4.04061,0 0.42591,0.21296 0.58423,0.7972 1.01015,1.01015 0.30117,0.15059 0.67343,0 1.01015,0 2.02031,0 4.04061,0 6.06092,0 0.33671,0 0.77205,0.2381 1.01015,0 0.23809,-0.23809 -0.2381,-0.77205 0,-1.01015 0.23809,-0.23809 0.67343,0 1.01015,0 0.33672,0 0.67344,0 1.01015,0 0.716,0 5.79974,0.13059 6.06092,0 0.42592,-0.21296 0.58423,-0.79719 1.01015,-1.01015 0.36531,-0.18265 4.34816,0 5.05076,0 0.70261,0 4.68546,-0.18265 5.05077,0 0.42592,0.21296 0.58423,0.79719 1.01015,1.01015 0.30117,0.15059 0.67344,0 1.01015,0 0.33672,0 0.67344,0 1.01016,0 1.68358,0 3.36717,0 5.05076,0 0.33672,0 0.70898,-0.15058 1.01015,0 3.35025,3.35026 -0.95238,-0.47619 2.02031,1.01015 0.42591,0.21296 0.58423,0.7972 1.01015,1.01016 0.60234,0.30117 1.54411,-0.47619 2.0203,0 0.2381,0.23809 -0.23809,0.77205 0,1.01015 0.2381,0.23809 0.67344,0 1.01016,0 0.33671,0 0.67343,0 1.01015,0" + id="path4651" + inkscape:connector-curvature="0" + inkscape:export-filename="/home/red/artikel_uart/capitalisation/rect4590.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + </g> +</svg> diff --git a/doc/using/UART_srcs/vhpi/makefile b/doc/using/UART_srcs/vhpi/makefile new file mode 100644 index 000000000..fdf5bc3b0 --- /dev/null +++ b/doc/using/UART_srcs/vhpi/makefile @@ -0,0 +1,22 @@ + + + +all: + + rm -rf work + mkdir work + + ghdl -a --work=work --workdir=work tty_pkg.vhd + gcc -c -fPIC tty.c -o tty.o + + ghdl -a --work=work --workdir=work ../capitalisation/capitalisation.vhd + ghdl -a --work=work --workdir=work tb_tty.vhd + + ghdl -e -Wl,tty.o --ieee=synopsys -fexplicit --workdir=work -Pwork tb_tty +# ghdl -r tb_tty --wave=tbench.ghw + ghdl -r tb_tty --wave=tbench.ghw --stop-time=500000us + + +view: + gtkwave tbench.ghw a.gtkw + diff --git a/doc/using/UART_srcs/vhpi/tb_tty.vhd b/doc/using/UART_srcs/vhpi/tb_tty.vhd new file mode 100644 index 000000000..6e1576ed5 --- /dev/null +++ b/doc/using/UART_srcs/vhpi/tb_tty.vhd @@ -0,0 +1,116 @@ +--tb_tty.vhd +LIBRARY ieee; +USE ieee.std_logic_1164.ALL; +USE ieee.numeric_std.ALL; +use work.tty_pkg.all; + +ENTITY tb_tty IS +END tb_tty; + +ARCHITECTURE behavior OF tb_tty IS + +signal clk : std_logic := '0'; +signal reset : std_logic; + +signal data_in : std_logic_vector(7 downto 0); +signal wdata : std_logic_vector(7 downto 0); +signal wr_en : std_logic:='1'; +signal wr : std_logic; +signal rd_en : std_logic; +signal rd : std_logic; +signal a : integer; +signal c : integer; + + +component capitalisation is + port( + clk : in std_logic; + reset : in std_logic; + --in + rdata : in std_logic_vector(7 downto 0); + rd_en : in std_logic; + rd : out std_logic; + --out + wdata : out std_logic_vector(7 downto 0); + wr_en : in std_logic; + wr : out std_logic + ); +end component; + + -- Clock period definitions + constant clk_period : time := 10 ns; + +subtype by_te is character; +type f_byte is file of by_te; + +BEGIN + +--file open + process + begin c<=tty_open(0); + wait; + end process; + +--read +process (clk) + +variable b: integer; +begin + if rising_edge(CLK) then + a<= read_enable(0); + if a=1 then + data_in<=std_logic_vector(to_unsigned(read_data(0),8)); + rd_en<='1'; + else + rd_en<='0'; + end if; + end if; + +end process; + +--write +process (clk) +variable b: integer; + + begin + if rising_edge(CLK) then + if reset='0' then + if wr='1' then + b:=to_integer(unsigned(wdata)); + write_data(b); + end if; + end if; + end if; + end process; + + stim_proc : process + begin + reset <= '1'; + + wait for 50 ns; + reset <='0'; + wait; + end process; + + clk_process :process + begin + clk <= '0'; + wait for clk_period/2; + clk <= '1'; + wait for clk_period/2; + end process; + +engine: capitalisation + port map( + clk => clk, + reset => reset, + --in + rdata => data_in, + rd_en => rd_en, + rd => rd, + --out + wdata => wdata, + wr_en => wr_en, + wr => wr + ); +END; diff --git a/doc/using/UART_srcs/vhpi/terminal.png b/doc/using/UART_srcs/vhpi/terminal.png Binary files differnew file mode 100644 index 000000000..a19f3cd64 --- /dev/null +++ b/doc/using/UART_srcs/vhpi/terminal.png diff --git a/doc/using/UART_srcs/vhpi/tty.c b/doc/using/UART_srcs/vhpi/tty.c new file mode 100644 index 000000000..c04f8f359 --- /dev/null +++ b/doc/using/UART_srcs/vhpi/tty.c @@ -0,0 +1,83 @@ +/* + VPI code allowing you to connect terminal emulator or other program to pty "connected" + to the UART-like port in IP core simulated in GHDL. + + This code is written by Wojciech M. Zabolotny (wz...@ise.pw.edu.pl) on 2nd June 2011 + and is published as PUBLIC DOMAIN + +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/ioctl.h> +#include <linux/ioctl.h> +#include <sys/stat.h> +#include <sys/poll.h> +#include <fcntl.h> +#include <errno.h> + +char *ptsname(int fd); + +int ptyf = -1; + + + +int tty_open(int a) +{ + ptyf = open("/dev/ptmx",O_RDWR); + if(ptyf<0) { + perror("I can't open pseudoterminal\n"); + return -1; + } + if(unlockpt(ptyf)<0) { + perror("I can't unlock pseudoterminal\n"); + return -1; + } + if(grantpt(ptyf)<0) { + perror("I can't grant pseudoterminal\n"); + return -1; + } + printf("Pseudoterminal: %s\n",ptsname(ptyf)); + // sleep(10); + return 0; +} + + +int read_enable(void) +{ + //In the masks below you may omit POLLHUP in this case + //disconnection of the terminal emulator from pty will not + //stop simulation, and you'll be able to reconnect + //the same or different program to pty and running simulation + struct pollfd pfd[1]={{ptyf,POLLIN | POLLERR | POLLHUP,0}}; + int res; + res=poll(pfd,1,0); + if(res==0) return 0; + if(res<0) return 0; //error + //If you removed POLLHUP from the mask above, you should remove it below too + if(pfd[0].revents & (POLLERR|POLLHUP)) return 0; //disconnected or error? + if(pfd[0].revents & POLLIN) return 1; + return 0; +} + + +int read_data(void) +{ + unsigned char c; + read(ptyf,&c,1); + return c; +} + +int write_data(int byte) +{ + unsigned char c = byte; + write(ptyf,&c,1); + + // Debug: printf("Writing %x to pty\n", c); + return 0; +} + diff --git a/doc/using/UART_srcs/vhpi/tty_pkg.vhd b/doc/using/UART_srcs/vhpi/tty_pkg.vhd new file mode 100644 index 000000000..99e3a347f --- /dev/null +++ b/doc/using/UART_srcs/vhpi/tty_pkg.vhd @@ -0,0 +1,70 @@ +--tty_pkg.vhd +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +package tty_pkg is + + function to_integer( s: std_logic) return integer; + function to_std_logic( s : integer ) return std_logic; + + function tty_open (portn : integer) return integer; + attribute foreign of tty_open : + function is "VHPIDIRECT tty_open"; + + function read_data ( dummy: integer) return integer; + attribute foreign of read_data : + function is "VHPIDIRECT read_data"; + + function read_enable ( dummy: integer) return integer; + attribute foreign of read_enable : + function is "VHPIDIRECT read_enable"; + + procedure write_data ( data: in integer); + attribute foreign of write_data : + procedure is "VHPIDIRECT write_data"; + +end; + + +package body tty_pkg is + + function to_integer( s : std_logic ) return integer is + begin + if s = '1' then + return 1; + else + return 0; + end if; + end function; + + function to_std_logic( s : integer ) return std_logic is + begin + if s > 0 then + return '1'; + else + return '0'; + end if; + end function; + + + function tty_open (portn : integer) return integer is + begin + assert false report "VHPI" severity failure; + end tty_open; + + function read_data (dummy: integer) return integer is + begin + assert false report "VHPI" severity failure; + end read_data; + + function read_enable (dummy: integer) return integer is + begin + assert false report "VHPI" severity failure; + end read_enable; + + procedure write_data ( data: in integer) is + begin + assert false report "VHPI" severity failure; + end write_data; +end tty_pkg; diff --git a/doc/using/UART_srcs/vhpi/zeichnung.png b/doc/using/UART_srcs/vhpi/zeichnung.png Binary files differnew file mode 100644 index 000000000..fbfdec259 --- /dev/null +++ b/doc/using/UART_srcs/vhpi/zeichnung.png |