0

I downloaded a VHDL LCD Library from http://www.intesc.mx/soporte and I'm getting the following error when checking Syntax :

Started : "Check Syntax for LIB_LCD_INTESC_REVB".
Running xst...
Command Line: xst -intstyle ise -ifn {D:/My pc/My documents/ISE/Libreria/LIB_LCD_INTESC_REVB.xst} -ofn LIB_LCD_INTESC_REVB.stx

=========================================================================
*                          HDL Compilation                              *
=========================================================================
Compiling vhdl file "D:/Drive/Cetys/3R semestre/Digitales 2/Morsese/LCD2x16RevB/LCD2x16RevB/COMANDOS_LCD_REVB.vhd" in Library work.
ERROR:HDLParsers:839 - "D:/Drive/Cetys/3R semestre/Digitales 2/Morsese/LCD2x16RevB/LCD2x16RevB/COMANDOS_LCD_REVB.vhd" Line 77. Selector (Constant 'DATO1' of type STRING) is an unconstrained array.

I'm getting the error in the line selected with (->) :

->    FUNCTION CHAR(DATO1 : STRING) RETURN STD_LOGIC_VECTOR IS     
VARIABLE DATAOUT1 : STD_LOGIC_VECTOR(8 DOWNTO 0);
BEGIN
    CASE DATO1 IS
    WHEN a => RETURN '1'&x"09";
    WHEN b => RETURN '1'&x"0A";
    WHEN c => RETURN '1'&x"0B";
    WHEN d => RETURN '1'&x"0C";
    WHEN e => RETURN '1'&x"0D";
    WHEN f => RETURN '1'&x"0E";
    WHEN g => RETURN '1'&x"0F";
    WHEN h => RETURN '1'&x"10";
    WHEN i => RETURN '1'&x"11";
    WHEN j => RETURN '1'&x"12";
    WHEN k => RETURN '1'&x"13";
    WHEN l => RETURN '1'&x"14";

I know the basics of VHDL, but I don't know how to debug these type of errors.

Thanks for the help.

1 Answers1

0

The selector of a case statement cannot be a string because strings are unconstrained arrays (arrays which length is unknown until you specify it) and are not a locally static type. VHDL case statements accept only selectors of a locally static type. Moreover, a, b, c... are not string literals. What you have downloaded is not VHDL. You can try to fix all this by modifying the code but I would not even try. It has been written by people who do not know VHDL and there are probably zillions of other problems. Anyway, you can try this, instead:

FUNCTION CHAR(DATO1 : character) RETURN STD_LOGIC_VECTOR IS     
VARIABLE DATAOUT1 : STD_LOGIC_VECTOR(8 DOWNTO 0);
BEGIN
    CASE DATO1 IS
    WHEN 'a' => RETURN '1'&x"09";
    WHEN 'b' => RETURN '1'&x"0A";
    WHEN 'c' => RETURN '1'&x"0B";
    ...

Of course, you will have to edit the calls to the CHAR function too: check that the passed parameter is a character, not a string.

Renaud Pacalet
  • 25,260
  • 3
  • 34
  • 51
  • Thanks for the quick answer ! How can you tell that the code is not VHDL or that It was written by people who do not know VHDL? I did what you said and I managed to fix It, among with other small things. – Roberto Cortez Dec 08 '15 at 19:46
  • Simple: somebody who thinks that `a`, `b`, `c`... are string literals is not fluent in VHDL and what he codes is not plain valid VHDL... unless you did not show us the whole code and there are declarations for string constants named `a`, `b`, `c`... – Renaud Pacalet Dec 09 '15 at 06:52
  • But the main reason is to believe that the selector of a case statement can be of type string. This is not valid VHDL and has not even been tested, I guess. – Renaud Pacalet Dec 09 '15 at 07:01
  • Oh well, thanks for the answer ! I'll skip this library and implement my own. – Roberto Cortez Dec 09 '15 at 23:36