How to let $display show colors?

V

Verictor

Guest
Hi,

Can someone show what the color ASCII code when using $display? For
example,

$display("error");

should be shown in red.

Thanks
 
On Sep 4, 11:46 am, Verictor <stehu...@gmail.com> wrote:
Hi,

Can someone show what the color ASCII code when using $display? For
example,

$display("error");

should be shown in red.

Thanks

The ASCII code does not specify coloring, only characters. The
display of character data in color is system dependent. For
example if you are printing to a terminal, often ANSI standard
codes or vt100 terminal codes (escape codes) can be used to
display color. Running under Windows, you can also use the
ANSI standard escape sequences in a DOS window by including
ansi.sys. However if you want to display in color in a
general windows application, like the transcript window of
ModelSim you may be out of luck.

HTH,
Gabor
 
gabor wrote:
On Sep 4, 11:46 am, Verictor <stehu...@gmail.com> wrote:
Hi,

Can someone show what the color ASCII code when using $display? For
example,

$display("error");

should be shown in red.

Thanks


The ASCII code does not specify coloring, only characters. The
display of character data in color is system dependent. For
example if you are printing to a terminal, often ANSI standard
codes or vt100 terminal codes (escape codes) can be used to
display color. Running under Windows, you can also use the
ANSI standard escape sequences in a DOS window by including
ansi.sys. However if you want to display in color in a
general windows application, like the transcript window of
ModelSim you may be out of luck.

HTH,
Gabor
Try this, which works for us.

$write("%c[1;34m",27);
$display("*********** This is in colour ***********");
$write("%c[0m",27);

The colour is defined by the 34m or 0m number and if you use an ANSI
compliant terminal you should use the standard codes


Cheers,

Iakovos

--
Think Silicon : VLSI Design Services & Consultancy
http://www.think-silicon.com
 

Welcome to EDABoard.com

Sponsor

Back
Top