diff options
Diffstat (limited to 'doc/using/UART_srcs/capitalisation')
-rw-r--r-- | doc/using/UART_srcs/capitalisation/Zeichnung.svg | 225 | ||||
-rw-r--r-- | doc/using/UART_srcs/capitalisation/capitalisation.png | bin | 0 -> 48212 bytes | |||
-rw-r--r-- | doc/using/UART_srcs/capitalisation/capitalisation.vhd | 51 | ||||
-rw-r--r-- | doc/using/UART_srcs/capitalisation/makefile | 18 | ||||
-rw-r--r-- | doc/using/UART_srcs/capitalisation/tb_capitalisation.vhd | 89 | ||||
-rw-r--r-- | doc/using/UART_srcs/capitalisation/top_capitalisation.vhd | 126 | ||||
-rw-r--r-- | doc/using/UART_srcs/capitalisation/zeichnung.png | bin | 0 -> 15065 bytes |
7 files changed, 509 insertions, 0 deletions
diff --git a/doc/using/UART_srcs/capitalisation/Zeichnung.svg b/doc/using/UART_srcs/capitalisation/Zeichnung.svg new file mode 100644 index 000000000..e64d02ab5 --- /dev/null +++ b/doc/using/UART_srcs/capitalisation/Zeichnung.svg @@ -0,0 +1,225 @@ +<?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"> + <defs + id="defs4"> + <marker + inkscape:isstock="true" + style="overflow:visible;" + id="marker4462" + refX="0.0" + refY="0.0" + orient="auto" + inkscape:stockid="Arrow1Lend"> + <path + transform="scale(0.8) rotate(180) translate(12.5,0)" + style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" + 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 " + id="path4464" /> + </marker> + <marker + inkscape:stockid="Arrow1Lend" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow1Lend" + style="overflow:visible;" + inkscape:isstock="true" + inkscape:collect="always"> + <path + id="path4183" + 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="1.4" + inkscape:cx="493.91425" + inkscape:cy="469.59264" + 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)"> + <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="443.14285" + y="623.79077" + id="text4136" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4138" + x="443.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="209.99998" + y="623.79077" + id="text4140" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4142" + x="209.99998" + y="623.79077">UART_8N1_RX</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="668.00006" + y="623.79077" + id="text4144" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4146" + x="668.00006" + y="623.79077">UART_8N1TX</tspan></text> + <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="rect4148" + width="182.85715" + height="70" + x="202.28572" + y="579.50507" /> + <rect + y="579.50507" + x="426.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" /> + <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="650.28577" + y="579.50507" /> + <rect + y="488.64792" + x="100.28571" + height="214.28572" + width="838.57147" + id="rect4154" + 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" /> + <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="139.71428" + y="618.07648" + id="text4156" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4158" + x="139.71428" + y="618.07648">RX</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="849.71429" + y="616.93365" + id="text4160" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4162" + x="849.71429" + y="616.93365">TX</tspan></text> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker4462)" + d="m 132.85714,626.64792 67.14286,0" + id="path4164" + inkscape:connector-curvature="0" /> + <path + inkscape:connector-curvature="0" + id="path4166" + d="m 834.85715,626.64792 67.14285,0" + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)" /> + <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="130" + y="529.50507" + id="text4168" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4170" + x="130" + y="529.50507">top_capitalisation</tspan></text> + <path + inkscape:connector-curvature="0" + id="path4172" + d="m 385.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" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 609.57141,626.64789 40.35714,0" + id="path4174" + inkscape:connector-curvature="0" /> + <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="-712.43713" + y="357.6622" + id="text4490" + sodipodi:linespacing="125%" + transform="matrix(0,-0.86921859,1.1504586,0,0,0)"><tspan + sodipodi:role="line" + id="tspan4492" + x="-712.43713" + y="357.6622">8bit parallel</tspan></text> + <text + transform="matrix(0,-0.86921859,1.1504586,0,0,0)" + sodipodi:linespacing="125%" + id="text4494" + y="553.23639" + 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"><tspan + y="553.23639" + x="-709.15009" + id="tspan4496" + sodipodi:role="line">8bit parallel</tspan></text> + </g> +</svg> diff --git a/doc/using/UART_srcs/capitalisation/capitalisation.png b/doc/using/UART_srcs/capitalisation/capitalisation.png Binary files differnew file mode 100644 index 000000000..5b6dcbc37 --- /dev/null +++ b/doc/using/UART_srcs/capitalisation/capitalisation.png diff --git a/doc/using/UART_srcs/capitalisation/capitalisation.vhd b/doc/using/UART_srcs/capitalisation/capitalisation.vhd new file mode 100644 index 000000000..e904eda95 --- /dev/null +++ b/doc/using/UART_srcs/capitalisation/capitalisation.vhd @@ -0,0 +1,51 @@ +-- loopback engine +---------------------------------------------------------------------- +library IEEE; +use IEEE.STD_LOGIC_1164.all; +use ieee.numeric_std.all; + +entity 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; + +architecture Behavioral of capitalisation is + + + +begin + + + process(clk) + begin + wr<='0'; + rd<='0'; + if wr_en='1' and rd_en ='1' then + wr<='1'; + rd<='1'; + if (unsigned(rdata)>X"60") and + (unsigned(rdata)<X"7B") then + wdata<=rdata(7 downto 6 )&'0'& rdata(4 downto 0); + else + wdata<=rdata; + end if; + end if; + if reset='1' then + wr<='0'; + end if; + end process; + + + +end Behavioral; + diff --git a/doc/using/UART_srcs/capitalisation/makefile b/doc/using/UART_srcs/capitalisation/makefile new file mode 100644 index 000000000..ad8a01b04 --- /dev/null +++ b/doc/using/UART_srcs/capitalisation/makefile @@ -0,0 +1,18 @@ +all: + rm -rf work + mkdir work + + ghdl -a --work=work --workdir=work top_capitalisation.vhd + ghdl -a --work=work --workdir=work capitalisation.vhd + ghdl -a --work=work --workdir=work ../rx/UART_RX_8N1.vhd + ghdl -a --work=work --workdir=work ../tx/UART_TX_8N1.vhd + ghdl -a --work=work --workdir=work capitalisation.vhd + + ghdl -a --work=work --workdir=work tb_capitalisation.vhd + ghdl -e --workdir=work -Pwork tb_capitalisation + ghdl -r tb_capitalisation --wave=tbench.ghw --stop-time=700us + + +view: + gtkwave tbench.ghw a.gtkw + diff --git a/doc/using/UART_srcs/capitalisation/tb_capitalisation.vhd b/doc/using/UART_srcs/capitalisation/tb_capitalisation.vhd new file mode 100644 index 000000000..364142946 --- /dev/null +++ b/doc/using/UART_srcs/capitalisation/tb_capitalisation.vhd @@ -0,0 +1,89 @@ +-- tb_capitalisation.vhd +---------------------------------------------------------------------- +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity tb_capitalisation is +end tb_capitalisation; + +architecture behavior of tb_capitalisation is + + constant board_clk_period : time := 10 ns; + constant board_clk_freq: integer :=100E6; --100MHz + + signal board_clk : std_logic := '0'; + signal reset : std_logic := '0'; + signal rx : std_logic := '1'; + signal tx : std_logic; + + procedure tx_char (signal txpin : out std_logic; + txdata : in character; baudrate : in integer) is + constant bittime : time := (integer(1000000000.0/real(baudrate))) * 1 ns; + variable c : std_logic_vector(7 downto 0); + begin + c := std_logic_vector(to_unsigned(character'pos(txdata), 8)); + txpin <= '0'; -- Startbit + wait for bittime; + for i in 0 to 7 loop + txpin <= c(i); + wait for bittime; + end loop; + txpin <= '1'; -- Stopbit + wait for bittime; + end tx_char; + + -- Component Declaration for the Unit Under Test (UUT) +component top_capitalisation is + generic (clk_freq : integer; + baudrate : integer); + port( + board_clk : in std_logic ; + reset : in std_logic ; + rx : in std_logic ; + tx : out std_logic ); +end component; + +begin + -- Instantiate the Unit Under Test (UUT) +UART_example: top_capitalisation + generic map ( + clk_freq => board_clk_freq, + baudrate =>115200) + port map( + board_clk => board_clk, + reset => reset, + rx => rx, + tx => tx ); + + process + begin + wait for 80000 ns; + tx_char(RX, '$', 115200); + tx_char(RX, 'g', 115200); + tx_char(RX, '#', 115200); + wait for 50 us; + tx_char(RX, 'b', 115200); + tx_char(RX, 'c', 115200); + wait; -- will wait forever + end process; + + -- 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 + process + begin + reset <= '1'; + wait for 100 ns; + reset <='0'; + wait; + end process; + +end; diff --git a/doc/using/UART_srcs/capitalisation/top_capitalisation.vhd b/doc/using/UART_srcs/capitalisation/top_capitalisation.vhd new file mode 100644 index 000000000..01c8e3585 --- /dev/null +++ b/doc/using/UART_srcs/capitalisation/top_capitalisation.vhd @@ -0,0 +1,126 @@ +-- top_capitalisation.vhd +---------------------------------------------------------------------- + +-- top_capitalisation +-- | +-- + capitalisation +-- + UART_8N1_RX +-- + UART_8N1_TX + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity top_capitalisation is + generic (clk_freq : integer; + baudrate : integer); + port( + board_clk : in std_logic ; + reset : in std_logic ; + rx : in std_logic ; + tx : out std_logic ); +end top_capitalisation; + +architecture behavior of top_capitalisation is + signal rd_en : std_logic; + signal rdata : std_logic_vector (7 downto 0); + signal rd : std_logic; + + signal wr_en : std_logic; + signal wdata : std_logic_vector (7 downto 0); + signal wr : std_logic; + +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; + +component UART_8N1_RX is + generic (clk_freq : integer; + baudrate : integer); + port( + clk : in std_logic; + reset : in std_logic; + --8bit interface + rdata : out std_logic_vector(7 downto 0); + rd : in std_logic; + rd_en : out std_logic; + --physical wire RX + rx : in std_logic + ); +end component; + +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; + + +begin + +UART_RX:UART_8N1_RX + generic map ( + clk_freq => clk_freq, + baudrate =>115200) + port map( + clk => board_clk, + reset => reset, + rdata => rdata, + rd => rd, + rd_en => rd_en, + --physical wire RX + rx => rx + ); + +trans: capitalisation + port map( + clk => board_clk, + reset => reset, + --in + rdata => rdata, + rd_en => rd_en, + rd => rd, + --out + wdata => wdata, + wr_en => wr_en, + wr => wr + ); + +UART_TX: UART_8N1_TX + generic map( + clk_freq => clk_freq, + baudrate => 115200) + port map( + clk => board_clk, + reset => reset, + --8bit interface + wdata => wdata, + wr => wr, + wr_en => wr_en, + + --physical wire TX + tx => tx + ); +end; diff --git a/doc/using/UART_srcs/capitalisation/zeichnung.png b/doc/using/UART_srcs/capitalisation/zeichnung.png Binary files differnew file mode 100644 index 000000000..f51a0fbdd --- /dev/null +++ b/doc/using/UART_srcs/capitalisation/zeichnung.png |