在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 4173|回复: 9

[原创] 发一个清晰显眼的打印C代码

[复制链接]
发表于 2012-3-8 09:19:41 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
我们在验证仿真结束(或者中间)的时候经常喜欢用$display打印一个“pass”或者“fail”,这样的信息显示在屏幕上不是很显眼,所以做了一个更清晰的打印代码。效果如下:

效果图

效果图

使用的时候可以在systemverilog代码中用 $systemf来调用它。

把代码贴一下(说明一下,字库数组用的是zimo21软件生成的)
#include <stdio.h>
#define NONE          "\033[m"
#define RED           "\033[0;32;31m"
#define LIGHT_RED     "\033[1;31m"
#define GREEN         "\033[0;32;32m"
#define LIGHT_GREEN   "\033[1;32m"
#define BLUE          "\033[0;32;34m"
#define LIGHT_BLUE    "\033[1;34m"
#define DARY_GRAY     "\033[1;30m"
#define CYAN          "\033[0;36m"
#define LIGHT_CYAN    "\033[1;36m"
#define PURPLE        "\033[0;35m"
#define LIGHT_PURPLE "\033[1;35m"
#define BROWN         "\033[0;33m"
#define YELLOW        "\033[1;33m"
#define LIGHT_GRAY    "\033[0;37m"
#define WHITE         "\033[1;37m"

#define WIDTH  8
#define HEIGHT 16
const char prime_char_map[][16] = {
/*--  char:     --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, \
/*--  char:  !  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x18,0x18,0x00,0x00}, \
/*--  char:  "  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x12,0x36,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, \
/*--  char:  #  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x24,0x24,0x24,0xFE,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x00,0x00}, \
/*--  char:  $  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x10,0x38,0x54,0x54,0x50,0x30,0x18,0x14,0x14,0x54,0x54,0x38,0x10,0x10}, \
/*--  char:  %  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x44,0xA4,0xA8,0xA8,0xA8,0x54,0x1A,0x2A,0x2A,0x2A,0x44,0x00,0x00}, \
/*--  char:  &  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x50,0x6E,0xA4,0x94,0x88,0x89,0x76,0x00,0x00}, \
/*--  char:  '  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x60,0x60,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, \
/*--  char:  (  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00}, \
/*--  char:  )  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00}, \
/*--  char:  *  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x10,0x10,0xD6,0x38,0x38,0xD6,0x10,0x10,0x00,0x00,0x00,0x00}, \
/*--  char:  +  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x00,0x00,0x00}, \
/*--  char:  ,  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0xC0}, \
/*--  char:  -  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, \
/*--  char:  .  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00}, \
/*--  char:  /  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00}, \
/*--  char:  0  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00}, \
/*--  char:  1  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00}, \
/*--  char:  2  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x04,0x04,0x08,0x10,0x20,0x42,0x7E,0x00,0x00}, \
/*--  char:  3  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x04,0x18,0x04,0x02,0x02,0x42,0x44,0x38,0x00,0x00}, \
/*--  char:  4  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x24,0x44,0x44,0x7E,0x04,0x04,0x1E,0x00,0x00}, \
/*--  char:  5  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x58,0x64,0x02,0x02,0x42,0x44,0x38,0x00,0x00}, \
/*--  char:  6  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x1C,0x24,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x24,0x18,0x00,0x00}, \
/*--  char:  7  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x7E,0x44,0x44,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00}, \
/*--  char:  8  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00}, \
/*--  char:  9  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x26,0x1A,0x02,0x02,0x24,0x38,0x00,0x00}, \
/*--  char:  :  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00}, \
/*--  char:  ;  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x20}, \
/*--  char:  <  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00}, \
/*--  char:  =  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00}, \
/*--  char:  >  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00}, \
/*--  char:  ?  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x62,0x02,0x04,0x08,0x08,0x00,0x18,0x18,0x00,0x00}, \
/*--  char:  @  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x38,0x44,0x5A,0xAA,0xAA,0xAA,0xAA,0xB4,0x42,0x44,0x38,0x00,0x00}, \
/*--  char:  A  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x10,0x10,0x18,0x28,0x28,0x24,0x3C,0x44,0x42,0x42,0xE7,0x00,0x00}, \
/*--  char:  B  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xF8,0x44,0x44,0x44,0x78,0x44,0x42,0x42,0x42,0x44,0xF8,0x00,0x00}, \
/*--  char:  C  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x3E,0x42,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x44,0x38,0x00,0x00}, \
/*--  char:  D  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xF8,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0xF8,0x00,0x00}, \
/*--  char:  E  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x42,0x42,0xFC,0x00,0x00}, \
/*--  char:  F  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x40,0x40,0xE0,0x00,0x00}, \
/*--  char:  G  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x3C,0x44,0x44,0x80,0x80,0x80,0x8E,0x84,0x44,0x44,0x38,0x00,0x00}, \
/*--  char:  H  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0xE7,0x00,0x00}, \
/*--  char:  I  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00}, \
/*--  char:  J  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0xF0}, \
/*--  char:  K  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xEE,0x44,0x48,0x50,0x70,0x50,0x48,0x48,0x44,0x44,0xEE,0x00,0x00}, \
/*--  char:  L  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0xFE,0x00,0x00}, \
/*--  char:  M  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xEE,0x6C,0x6C,0x6C,0x6C,0x54,0x54,0x54,0x54,0x54,0xD6,0x00,0x00}, \
/*--  char:  N  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xC7,0x62,0x62,0x52,0x52,0x4A,0x4A,0x4A,0x46,0x46,0xE2,0x00,0x00}, \
/*--  char:  O  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00}, \
/*--  char:  P  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x40,0xE0,0x00,0x00}, \
/*--  char:  Q  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0xB2,0xCA,0x4C,0x38,0x06,0x00}, \
/*--  char:  R  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x7C,0x48,0x48,0x44,0x44,0x42,0xE3,0x00,0x00}, \
/*--  char:  S  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x3E,0x42,0x42,0x40,0x20,0x18,0x04,0x02,0x42,0x42,0x7C,0x00,0x00}, \
/*--  char:  T  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xFE,0x92,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00}, \
/*--  char:  U  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00}, \
/*--  char:  V  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xE7,0x42,0x42,0x44,0x24,0x24,0x28,0x28,0x18,0x10,0x10,0x00,0x00}, \
/*--  char:  W  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xD6,0x92,0x92,0x92,0x92,0xAA,0xAA,0x6C,0x44,0x44,0x44,0x00,0x00}, \
/*--  char:  X  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x18,0x18,0x18,0x24,0x24,0x42,0xE7,0x00,0x00}, \
/*--  char:  Y  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00}, \
/*--  char:  Z  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x7E,0x84,0x04,0x08,0x08,0x10,0x20,0x20,0x42,0x42,0xFC,0x00,0x00}, \
/*--  char:  [  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0x00}, \
/*--  char:  \  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x02}, \
/*--  char:  ]  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78,0x00}, \
/*--  char:  ^  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x1C,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, \
/*--  char:  _  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF}, \
/*--  char:  `  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, \
/*--  char:  a  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x1E,0x22,0x42,0x42,0x3F,0x00,0x00}, \
/*--  char:  b  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x64,0x58,0x00,0x00}, \
/*--  char:  c  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00}, \
/*--  char:  d  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x06,0x02,0x02,0x02,0x1E,0x22,0x42,0x42,0x42,0x26,0x1B,0x00,0x00}, \
/*--  char:  e  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x40,0x40,0x42,0x3C,0x00,0x00}, \
/*--  char:  f  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x0F,0x11,0x10,0x10,0x7E,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00}, \
/*--  char:  g  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x44,0x44,0x38,0x40,0x3C,0x42,0x42,0x3C}, \
/*--  char:  h  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00}, \
/*--  char:  i  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00}, \
/*--  char:  j  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x1C,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x78}, \
/*--  char:  k  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x4E,0x48,0x50,0x68,0x48,0x44,0xEE,0x00,0x00}, \
/*--  char:  l  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00}, \
/*--  char:  m  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x49,0x49,0x49,0x49,0x49,0xED,0x00,0x00}, \
/*--  char:  n  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00}, \
/*--  char:  o  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00}, \
/*--  char:  p  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x64,0x42,0x42,0x42,0x44,0x78,0x40,0xE0}, \
/*--  char:  q  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x22,0x42,0x42,0x42,0x22,0x1E,0x02,0x07}, \
/*--  char:  r  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x32,0x20,0x20,0x20,0x20,0xF8,0x00,0x00}, \
/*--  char:  s  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x40,0x3C,0x02,0x42,0x7C,0x00,0x00}, \
/*--  char:  t  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x10,0x0C,0x00,0x00}, \
/*--  char:  u  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0x42,0x42,0x42,0x42,0x46,0x3B,0x00,0x00}, \
/*--  char:  v  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x10,0x10,0x00,0x00}, \
/*--  char:  w  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD7,0x92,0x92,0xAA,0xAA,0x44,0x44,0x00,0x00}, \
/*--  char:  x  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x24,0x18,0x18,0x18,0x24,0x76,0x00,0x00}, \
/*--  char:  y  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x18,0x10,0x10,0xE0}, \
/*--  char:  z  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x44,0x08,0x10,0x10,0x22,0x7E,0x00,0x00}, \
/*--  char:  {  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x03,0x04,0x04,0x04,0x04,0x04,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x03,0x00}, \
/*--  char:  |  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08}, \
/*--  char:  }  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x00,0x60,0x10,0x10,0x10,0x10,0x10,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x60,0x00}, \
/*--  char:  ~  --*/
/*--  WIDTH * HEIGHT =8x16   --*/
{0x30,0x4C,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} \
};
int main(int argc, char*argv[]) {
    if (argc<2) {
        printf("Usage err: need argv!\n");
        return 0;
    }
    char * str = argv[1];
    unsigned int size = strlen(str);     
    int i,j,k;
    char p;
    int offset;
    unsigned int bit;
   
    printf(LIGHT_RED);
    for(j=0;j<HEIGHT;j++){
        for(i=0;i<16;i++){
            if (i == size) {
                break;
            }
            p = str;
            offset = p - 32;
            bit = 0x80;
            for (k=0;k<WIDTH;k++){
                if (prime_char_map[offset][j] & bit) {
                    printf("#");
                }
                else {
                    printf(" ");
                }
                bit = (bit>>1);
            }
        }
        printf("\n");
    }
    printf("\n");
    printf(NONE);
    return 0;
}
发表于 2012-3-8 11:26:53 | 显示全部楼层
不错不错啊,哈哈。。。
发表于 2012-3-27 12:30:12 | 显示全部楼层
不错的代码~
发表于 2012-3-28 21:22:13 | 显示全部楼层
对这个代码很感兴趣啊,但是不知道具体在sv中怎么调用啊?没用过DPI,可以给个调用的文件看看吗
发表于 2012-8-18 00:27:11 | 显示全部楼层
回复 1# lshj98115
C 代码可以去掉。用这个包: Term::ANSIColor
发表于 2012-8-18 20:12:31 | 显示全部楼层
$display("xxx");
可以直接用颜色字符。试过。
 楼主| 发表于 2012-8-20 09:27:54 | 显示全部楼层
回复 6# tiangua


    $display支持调整字符大小不?
 楼主| 发表于 2012-8-20 09:37:01 | 显示全部楼层
回复 5# ksol


    字体的大小怎么调整?
发表于 2012-8-20 14:51:37 | 显示全部楼层
回复 8# lshj98115
这个包可能不能。不过闪烁一下也很醒目了。凑合一下吧。
发表于 2012-8-21 00:40:01 | 显示全部楼层
只要printf能做到的,$display也可以 。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

×

小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-12-23 21:55 , Processed in 0.027542 second(s), 10 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表