Talk About Network

Google





Electronic Equipment > VHDL > Re: String to s...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 11 Topic 6055 of 6445
Post > Topic >>

Re: String to std_logic_vector

by Mike Treseler <mike_treseler@[EMAIL PROTECTED] > May 30, 2008 at 10:24 AM

Shannon wrote:

> Or something like that?

-- or this:

   type char2std_t is array(character) of std_ulogic;

   constant char2std_c : char2std_t := (
      'U' => 'U',
      'X' => 'X',
      '0' => '0',
      '1' => '1',
      'Z' => 'Z',
      'W' => 'W',
      'L' => 'L',
      'H' => 'H',
      '-' => '-',
      others => 'X');

   function str2std(arg : string) return std_logic_vector is
      variable result : std_logic_vector(arg'length - 1 downto 0);
      variable j      : integer;
   begin
      j := arg'length -1;
      for i in arg'range loop
         result(j) := char2std_c(arg(i));
         j         := j -1;
      end loop;
      return result;
   end function;



-- Mike Treseler
 




 11 Posts in Topic:
String to std_logic_vector
Shannon <sgomes@[EMAIL  2008-05-30 09:16:54 
Re: String to std_logic_vector
KJ <kkjennings@[EMAIL   2008-05-30 09:47:43 
Re: String to std_logic_vector
Shannon <sgomes@[EMAIL  2008-05-30 10:03:12 
Re: String to std_logic_vector
Mike Treseler <mike_tr  2008-05-30 10:24:50 
Re: String to std_logic_vector
KJ <kkjennings@[EMAIL   2008-05-30 10:31:50 
Re: String to std_logic_vector
Shannon <sgomes@[EMAIL  2008-05-30 11:09:46 
Re: String to std_logic_vector
Mike Treseler <mike_tr  2008-05-30 11:40:44 
Re: String to std_logic_vector
Shannon <sgomes@[EMAIL  2008-05-30 12:59:27 
Re: String to std_logic_vector
"KJ" <kkjenn  2008-05-30 16:55:55 
Re: String to std_logic_vector
"KJ" <kkjenn  2008-05-30 17:06:25 
Re: String to std_logic_vector
Shannon <sgomes@[EMAIL  2008-05-30 15:49:35 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Thu Jan 8 17:24:53 PST 2009.