aboutsummaryrefslogtreecommitdiffstats
path: root/doc/using/UART_srcs/file_in_out
diff options
context:
space:
mode:
Diffstat (limited to 'doc/using/UART_srcs/file_in_out')
-rw-r--r--doc/using/UART_srcs/file_in_out/Zeichnung.svg290
-rw-r--r--doc/using/UART_srcs/file_in_out/makefile13
-rw-r--r--doc/using/UART_srcs/file_in_out/tb_file.vhd142
-rw-r--r--doc/using/UART_srcs/file_in_out/test.txt1
-rw-r--r--doc/using/UART_srcs/file_in_out/test1.txt1
-rw-r--r--doc/using/UART_srcs/file_in_out/zeichnung.pngbin0 -> 11280 bytes
6 files changed, 447 insertions, 0 deletions
diff --git a/doc/using/UART_srcs/file_in_out/Zeichnung.svg b/doc/using/UART_srcs/file_in_out/Zeichnung.svg
new file mode 100644
index 000000000..ae9e85d86
--- /dev/null
+++ b/doc/using/UART_srcs/file_in_out/Zeichnung.svg
@@ -0,0 +1,290 @@
+<?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="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>
+ <marker
+ inkscape:isstock="true"
+ style="overflow:visible;"
+ id="marker5229"
+ refX="0.0"
+ refY="0.0"
+ orient="auto"
+ inkscape:stockid="Arrow1Lend"
+ inkscape:collect="always">
+ <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="path5231" />
+ </marker>
+ <marker
+ inkscape:isstock="true"
+ style="overflow:visible;"
+ id="marker4462"
+ refX="0.0"
+ refY="0.0"
+ orient="auto"
+ inkscape:stockid="Arrow1Lend"
+ inkscape:collect="always">
+ <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="0.98994949"
+ inkscape:cx="501.72415"
+ inkscape:cy="479.92169"
+ 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 55.075395,626.64791 142.871835,0"
+ id="path4164"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4166"
+ d="m 834.85716,626.64794 142.87183,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="693.68311"
+ y="522.13812"
+ id="text4168"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4170"
+ x="693.68311"
+ y="522.13812">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>
+ <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="110.25892"
+ y="516.77045"
+ id="text4517"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4519"
+ x="110.25892"
+ y="516.77045">board_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="114.15372"
+ y="548.17877"
+ id="text4521"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4523"
+ x="114.15372"
+ y="548.17877">reset</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(#marker5229)"
+ d="m 58.131259,544.64792 40.588544,0"
+ id="path5227"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path5515"
+ d="m 58.131259,508.64792 40.588544,0"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker5517)" />
+ </g>
+</svg>
diff --git a/doc/using/UART_srcs/file_in_out/makefile b/doc/using/UART_srcs/file_in_out/makefile
new file mode 100644
index 000000000..e7ee72400
--- /dev/null
+++ b/doc/using/UART_srcs/file_in_out/makefile
@@ -0,0 +1,13 @@
+all:
+ rm -rf work
+ mkdir work
+
+ ghdl -a --work=work --workdir=work ../capitalisation/capitalisation.vhd
+ ghdl -a --work=work --workdir=work tb_file.vhd
+ ghdl -e --ieee=synopsys -fexplicit --workdir=work -Pwork tb_file
+ ghdl -r tb_file --wave=tbench.ghw --stop-time=200us
+
+
+view:
+ gtkwave tbench.ghw a.gtkw
+
diff --git a/doc/using/UART_srcs/file_in_out/tb_file.vhd b/doc/using/UART_srcs/file_in_out/tb_file.vhd
new file mode 100644
index 000000000..fe18f6665
--- /dev/null
+++ b/doc/using/UART_srcs/file_in_out/tb_file.vhd
@@ -0,0 +1,142 @@
+--tb_file.vhd
+------------------------------------------------------------------------
+LIBRARY ieee;
+USE ieee.std_logic_1164.ALL;
+USE ieee.numeric_std.ALL;
+
+ENTITY tb_file IS
+END tb_file;
+--vhdl no seek or rewind function in VHDL
+
+ARCHITECTURE behavior OF tb_file IS
+
+signal clk : std_logic := '0';
+signal reset : std_logic;
+
+signal rdata : std_logic_vector(7 downto 0);
+signal rd_en : std_logic;
+signal rd : std_logic;
+
+signal wdata : std_logic_vector(7 downto 0);
+signal wr_en : std_logic:='1';
+signal wr : std_logic;
+
+ -- Component Declaration for the Unit Under Test (UUT)
+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
+
+process(clk)
+begin
+ if rising_edge (clk) then
+ if reset='0' then
+ wr_en<='1';
+ else
+ wr_en<='0';
+ end if;
+ end if;
+end process;
+
+--read a file
+process (reset,clk)
+constant file_name: string:="test.txt";
+file in_file: f_byte open read_mode is file_name;
+
+variable a:character;
+
+begin
+ if reset='1' then
+ rd_en<='0';
+ else
+
+ if rising_edge(clk) then
+ if rd_en='0' or rd='1' then
+ if not endfile (in_file) then
+ read(in_file,a);
+ rdata<=std_logic_vector(to_unsigned(character'pos(a),8));
+ --very tricky the conversation
+ rd_en<='1';
+ else
+ rd_en<='0';
+ end if;
+ end if;
+ end if;
+ --wait until rising_edge(CLK) and rd='1';
+ end if;
+end process;
+
+
+
+--write a file
+process (clk)
+constant file_name: string:="test1.txt";
+file out_file: f_byte open write_mode is file_name;
+
+----variable in_line,out_line: line;
+variable b:character;
+
+ begin
+ if rising_edge(CLK) then
+ if reset='0' then
+ if wr='1' then
+ b:=character'val(to_integer(unsigned(wdata)));
+ write(out_file,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,
+
+ rdata => rdata,
+ rd_en => rd_en,
+ rd => rd,
+
+ wdata => wdata,
+ wr_en => wr_en,
+ wr => wr
+ );
+
+
+END;
diff --git a/doc/using/UART_srcs/file_in_out/test.txt b/doc/using/UART_srcs/file_in_out/test.txt
new file mode 100644
index 000000000..3ee58d9a3
--- /dev/null
+++ b/doc/using/UART_srcs/file_in_out/test.txt
@@ -0,0 +1 @@
+Hallo world! Can you see my text?
diff --git a/doc/using/UART_srcs/file_in_out/test1.txt b/doc/using/UART_srcs/file_in_out/test1.txt
new file mode 100644
index 000000000..a868f3f93
--- /dev/null
+++ b/doc/using/UART_srcs/file_in_out/test1.txt
@@ -0,0 +1 @@
+HALLO WORLD! CAN YOU SEE MY TEXT?
diff --git a/doc/using/UART_srcs/file_in_out/zeichnung.png b/doc/using/UART_srcs/file_in_out/zeichnung.png
new file mode 100644
index 000000000..e849417f4
--- /dev/null
+++ b/doc/using/UART_srcs/file_in_out/zeichnung.png
Binary files differ