Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Entering ASCII test values in ModelSim

Hello everyone,

I am new to the ModelSim software and had a question regarding ASCII test values. At the moment, I am comfortable with the "Create Wave" function where I can establish a clock, a constant, etc. with one of my signals. However, I have no clue how to assign an ASCII value to one of my inputs and have it displayed in the Wave window. My project is a state machine that logs ASCII inputs and will generate a '1' output when 'm', 'p', and '3' are entered sequentially. Thank you in advance for your help!

- dylpillz

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    VHDL Character-to-integer conversion:

    
    variable c : character;
    variable i  : integer;
    i := character'pos(c);
    

    VHDL Integer-to-character conversion:

    
     c := character'val(i);
    

    Cheers,

    Dave