function conversion_X(char:character)
return std_logic_vector is
begin
return
std_logic_vector(to_unsigned(character'pos(char),8));
end conversion_X;
This should
work w/ either packages STD_LOGIC_ARITH or NUMERIC_STD.
-
From jprowak@intrinsix.com
--============================================================================
--============================================================================
--
-- Numeric_Bit_TextIO package (c)TransEDA Limited
-- All rights reserved
-- This source code can be distributed freely provided it contains the
copyright
--
-- This package extends TextIO to allow the reading and writing of the types
-- defined in 1076.3 package Numeric_Bit
--
-- This version of the package is completely portable since it is layered onto
TextIO
-- and makes no use of the internal operation of TextIO.
--
-- version history:
-- v0.0 AR 27-11-95 basic package with complete set of read/write procedures
--
--============================================================================
--============================================================================
use std.textio.all;
library ieee; use ieee.numeric_bit.all;
package numeric_bit_textio is
procedure read (l : inout line;
value : out signed);
procedure read (l : inout line;
value : out unsigned);
procedure read (l : inout line;
value : out signed; good : out boolean);
procedure read (l : inout line;
value : out unsigned; good : out boolean);
procedure write (l : inout line;
value : in signed; justified : in side := right; field : in width := 0);
procedure write (l : inout line;
value : in unsigned; justified : in side := right; field : in width := 0);
end numeric_bit_textio;
package body numeric_bit_textio is
procedure read(l : inout line; value
: out signed; good : out boolean) is
variable bv_value :
bit_vector(value'range);
begin
read (l, bv_value, good);
value := signed(bv_value);
end;
procedure read (l : inout line;
value : out signed) is
variable good: boolean;
begin
read (l, value, good);
assert good report
"numeric_bit_textio: read(line,signed) failed" severity error;
end;
procedure read(l : inout line; value
: out unsigned; good : out boolean) is
variable bv_value :
bit_vector(value'range);
begin
read (l, bv_value, good);
value := unsigned(bv_value);
end;
procedure read (l : inout line;
value : out unsigned) is
variable good: boolean;
begin
read (l, value, good);
assert good report
"numeric_bit_textio: read(line,unsigned) failed" severity error;
end;
procedure write(l : inout line;
value : in signed; justified : in side := right; field : in width := 0) is
begin
write (l, bit_vector(value),
justified, field);
end;
procedure write(l : inout line;
value : in unsigned; justified : in side := right; field : in width := 0) is
begin
write (l, bit_vector(value),
justified, field);
end;
end;
--============================================================================
--============================================================================
--
-- Numeric_Std_TextIO package (c)TransEDA Limited
-- All rights reserved
-- This source code can be distributed freely provided it contains the
copyright
--
-- This package extends TextIO to allow the reading and writing of the types
-- defined in 1076.3 package Numeric_Std
--
-- This version of the package is completely portable since it is layered onto
TextIO
-- and makes no use of the internal operation of TextIO.
--
-- version history:
-- v0.0 AR 27-11-95 basic package with complete set of read/write procedures
--
--============================================================================
--============================================================================
use std.textio.all;
library ieee; use ieee.numeric_std.all, ieee.std_logic_1164.all;
package numeric_std_textio is
procedure
read (l : inout line; value : out signed);
procedure
read (l : inout line; value : out unsigned);
procedure
read (l : inout line; value : out signed; good : out boolean);
procedure
read (l : inout line; value : out unsigned; good : out boolean);
procedure
write (l : inout line; value : in signed; justified : in side := right; field :
in width := 0);
procedure
write (l : inout line; value : in unsigned; justified : in side := right; field
: in width := 0);
end numeric_std_textio;
library ieee; use ieee.std_logic_textio.all;
package body numeric_std_textio is
procedure
read(l : inout line; value : out signed; good : out boolean) is
variable
bv_value : std_logic_vector(value'range);
begin
read
(l, bv_value, good);
value
:= signed(bv_value);
end;
procedure read (l : inout line; value : out signed) is
variable good: boolean;
begin
read (l, value, good);
assert good report "numeric_std_textio: read(line,signed) failed"
severity error;
end;
procedure read(l : inout line; value : out unsigned; good : out boolean) is
variable bv_value : std_logic_vector(value'range);
begin
read (l, bv_value, good);
value := unsigned(bv_value);
end;
procedure read (l : inout line; value : out unsigned) is
variable good: boolean;
begin
read (l, value, good);
assert good report "numeric_std_textio: read(line,unsigned) failed"
severity error;
end;
procedure write(l : inout line; value : in signed; justified : in side :=
right; field : in width := 0) is
begin
write (l, std_logic_vector(value), justified, field);
end;
procedure write(l : inout line; value : in unsigned; justified : in side :=
right; field : in width := 0) is
begin
write (l, std_logic_vector(value), justified, field);
end;
end;
Last updated: September 28, 2000
Copyright owned by the contributors except where not
specified – these are copyright Star Galaxy Publishing.