亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? verilog2c++.cc

?? 將Verilog代碼轉換成C++代碼的軟件
?? CC
?? 第 1 頁 / 共 4 頁
字號:
/* * Copyright (c) 2000-2002 moe * *    This source code is free software; you can redistribute it *    and/or modify it in source code form under the terms of the GNU *    General Public License as published by the Free Software *    Foundation; either version 2 of the License, or (at your option) *    any later version. * *    This program is distributed in the hope that it will be useful, *    but WITHOUT ANY WARRANTY; without even the implied warranty of *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *    GNU General Public License for more details. * *    You should have received a copy of the GNU General Public License *    along with this program; if not, write to the Free Software *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */#include <string>#include <cstdlib>#include <cstdio>#include <typeinfo>#include <fstream>#include <iostream>#include "Verilog.hh"namespace moe{    static void printProgress(ostream& ostr,double ratio)  {    if( ratio<0 )      ostr << "....";    else      {	ostr << "\b\b\b\b" << setw(3) << int(ratio) << '%';ostr.flush();      }  }  static void printNet(ostream& ostr,int indent,const Verilog::Net* net)  {    if( net->sign() )      {	if( net->width()<=32 )	  ostr << setw(indent) << "" << " int32_t   ";	else if( net->width()<=64 )	  ostr << setw(indent) << "" << " int64_t   ";	else	  ostr << setw(indent) << "" << " IntN<" << setw(3) << net->width() << "> ";      }    else      {	if( net->width()<=32 )	  ostr << setw(indent) << "" << "uint32_t   ";	else if( net->width()<=64 )	  ostr << setw(indent) << "" << "uint64_t   ";	else	  ostr << setw(indent) << "" << "UIntN<" << setw(3) << net->width() << "> ";      }    ostr << 'n' << (uint)net;    if( net->isArray() )      ostr << '[' << net->depth() << ']';    ostr << ";";  }  static void printPort(ostream& ostr,int indent,const Verilog::Net* net,const string& name)  {    if( net->width()<=32 )      ostr << setw(indent) << "" << "uint32_t&  ";    else if( net->width()<=64 )      ostr << setw(indent) << "" << "uint64_t&  ";    else      ostr << setw(indent) << "" << "UIntN<" << setw(3) << net->width() << ">& ";        ostr << name << "() { return ";    //		  hhstr.form("n%08X",i->second);    ostr << 'n' << (uint)net;    ostr << "; }";  }  static void printClass(ostream& ostr,unsigned int width,int indent=0)  {    if( width<=32 )      ostr << setw(indent) << "" << "uint32_t   ";    else if( width<=64 )      ostr << setw(indent) << "" << "uint64_t   ";    else      ostr << setw(indent) << "" << "UIntN<" << setw(3) << width << "> ";  }  static void printPort(ostream& ostr,unsigned int width,int indent=0)  {    if( width<=32 )      ostr << setw(indent) << "" << "uint32_t&  ";    else if( width<=64 )      ostr << setw(indent) << "" << "uint64_t&  ";    else      ostr << setw(indent) << "" << "UIntN<" << setw(3) << width << ">& ";  }  static void printCast(ostream& ostr,unsigned int width)  {    if( width<=32 )      ostr << "uint32_t";    else if( width<=64 )      ostr << "uint64_t";    else      ostr << "UIntN<" << setw(3) << width << ">";  }  static void printRef(ostream& ostr,unsigned int width)  {    if( width<=32 )      ostr << "uint32_t";    else if( width<=64 )      ostr << "uint64_t";    else      ostr << "const UIntN<" << setw(3) << width << ">&";  }  static void printSignMask(ostream& ostr,unsigned int cast,unsigned int width)  {    if( cast<=32 )      ostr << (0xFFFFFFFFUL<<(width-1)) << "UL";    else if( cast<=64 )      ostr << (0xFFFFFFFFFFFFFFFFULL<<(width-1)) << "ULL";    else      ostr << "SignMask(" << (width-1) << ')';  }  static void printMask(ostream& ostr,unsigned int width,			unsigned int msb,unsigned int lsb)  {    if( width<=32 )      ostr << ((0xFFFFFFFFUL>>(32-(msb-lsb+1)))<<lsb) << "UL";    else if( width<=64 )      ostr << ((0xFFFFFFFFFFFFFFFFULL>>(64-(msb-lsb+1)))<<lsb) << "ULL";    else      ostr << "Mask(" << msb << ',' << lsb << ')';  }  static void printMask(ostream& ostr,unsigned int width)  {    if( width<=32 )      ostr << (0xFFFFFFFFUL>>(32-width)) << "UL";    else if( width<=64 )      ostr << (0xFFFFFFFFFFFFFFFFULL>>(64-width)) << "ULL";    else      ostr << "Mask(" << width << ')';  }  static uint64_t calcConstant(const string& num)  {    uint64_t ret =0;    int i;    for( i=0;i<num.size();i++ )      {	ret =ret<<1;	if( num[i]=='1' )	  ret |=1;      }    return ret;  }      ////////////////////////////////////////////////////////////////////////  class Convert : public Verilog  {            ////////////////////////////////////////////////////////////////////////    class RightExpression : public Callback    {      bool     comm_;      ostream& ostr_;      unsigned int cast_;    public:      RightExpression():	comm_(true),	ostr_(std::cout),	cast_(32)      {}      RightExpression(bool comm,ostream& ostr,unsigned int cast):	comm_(comm),	ostr_(ostr),	cast_(cast)      {}      ~RightExpression(){}            void trap(const Number* self)      {	{	  if( self->width()<=32 )	    ostr_ << self->calcConstant() << "UL";	  else if( self->width()<=64 )	    ostr_ << self->calcConstant() << "ULL";	  else	    ostr_ << '\"' <<  self->value() << '\"';	}	if( self->isPartial() )	  {	    ostr_ << ',';	    	    if( self->width()<=32 )	      ostr_ << calcConstant( self->mask() ) << "UL";	    else if( self->width()<=64 )	      ostr_ << calcConstant( self->mask() ) << "ULL";	    else	      ostr_ << "Constant(" <<  self->mask() << ')';	  }      }      void trap(const Identifier* self)      {	if( self->net()->isArray() )	  {	    //	    ostr_.form("n%08X",self->net());	    ostr_ << 'n' << (uint)self->net();	    ostr_ << '[';	    self->idx()->callback( *this );	    ostr_ << '-' << self->net()->sa()->calcConstant();	    ostr_ << ']';	  }	else	  {	    if( self->idx()!=NULL )	      {		ostr_ << "EmVer::Index(";		//		ostr_.form("n%08X",self->net());		ostr_ << 'n' << (uint)self->net();		ostr_ << ',';		ostr_ << self->idx()->calcConstant();		ostr_ << '-' << self->net()->lsb()->calcConstant();		ostr_ << ')';	      }	    else if( self->msb()!=NULL && self->lsb()!=NULL )	      {		ostr_ << "EmVer::Part(";		//		ostr_.form("n%08X",self->net());		ostr_ << 'n' << (uint)self->net();		ostr_ << ',';				if( self->net()->width() <=32 )		  {		    ostr_ << self->lsb()->calcConstant();		    ostr_ << '-' << self->net()->lsb()->calcConstant();		    ostr_ << ',';		    //		    ostr_.form("0x%08XUL",0xFFFFFFFFUL>>		    ostr_ << (0xFFFFFFFFUL>>			      (31-(self->msb()->calcConstant()-self->lsb()->calcConstant()))) << "UL";		  }		else if( self->net()->width() <=64 )		  {		    ostr_ << self->lsb()->calcConstant();		    ostr_ << '-' << self->net()->lsb()->calcConstant();		    ostr_ << ',';		    //		    ostr_.form("0x%016lXULL",0xFFFFFFFFFFFFFFFFULL>>		    ostr_ << (0xFFFFFFFFFFFFFFFFULL>>			      (63-(self->msb()->calcConstant()-self->lsb()->calcConstant()))) << "ULL";		  }		else		  {		    ostr_ << self->lsb()->calcConstant();		    ostr_ << '-' << self->net()->lsb()->calcConstant();		    ostr_ << ',';		    		    ostr_ << self->msb()->calcConstant();		    ostr_ << '-' << self->lsb()->calcConstant();		  }				ostr_ << ')';	      }	    else	      //	      ostr_.form("n%08X",self->net());	      ostr_ << 'n' << (uint)self->net();	  }      }      void trap(const Concat* self)      {	int cast=self->width();		if( self->repeat()!=NULL )	  {	    ostr_ << "EmVer::Repeat(";	    ostr_ << self->repeat()->calcConstant();	    ostr_ << ',';	    cast /=self->repeat()->calcConstant();	  }		if( self->list().size()==1 )	  {	    printCast(ostr_,cast);	    ostr_ << '(';	    self->list().front()->callback( *this );	    ostr_ << ')';	  }	else	  {	    {	      vector<Expression*>::const_iterator i;	      for( i=self->list().begin();i!=self->list().end();++i )		{		  if( (*i)!=self->list().back() )		    {		      ostr_ << "EmVer::Concat(";		      		      printCast(ostr_,cast);		      ostr_ << '(';		      (*i)->callback( *this );		      ostr_ << ')';		      ostr_ << ',';		      		    }		  else		    {		      printCast(ostr_,cast);		      ostr_ << '(';		      (*i)->callback( *this );		      ostr_ << ')';		    }		}	    }	    	    {	      vector<Expression*>::const_reverse_iterator i;	      int sum =0;	      for( i=self->list().rbegin();i!=self->list().rend();++i )		{		  if( (*i)!=self->list().front() )		    {		      sum +=(*i)->width();		      ostr_ << ',';		      ostr_ << sum;		      ostr_ << ')';		    }		}	    }	  }		if( self->repeat()!=NULL )	  {	    ostr_ << ',';	    ostr_ << cast;	    ostr_ << ')';	  }      }      void trap(const Event* self)      {	std::cerr << " a event expression in this statement is failure profit. \n";      }      ////////////////////////////////////      void trap(const Unary* self)      {	switch( self->operation() )	  {	  case Expression::ArithmeticMinus:	    ostr_ << "(-";	    self->value()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::BitwiseNegation:	    ostr_ << "((~";	    self->value()->callback( *this );	    ostr_ << ')';	    ostr_ << "&";	    printMask(ostr_,self->value()->width(),self->value()->width()-1,0);	    ostr_ << ')';	    break;	    	  case Expression::LogicalNegation:	    ostr_ << "(!";	    self->value()->callback( *this );	    ostr_ << ')';	    break;	    	  case Expression::ReductionAND:	  case Expression::ReductionOR:	  case Expression::ReductionXOR:	  case Expression::ReductionNAND:	  case Expression::ReductionNOR:	  case Expression::ReductionNXOR:	    ostr_ << "EmVer::" << self->opName();	    ostr_ << '(';	    self->value()->callback( *this );	    ostr_ << ',';	    printMask(ostr_,self->value()->width(),self->value()->width()-1,0);	    ostr_ << ')';	    break;	  case Expression::CastSigned:	    ostr_ << "EmVer::SignExt";	    ostr_ << '(';	    self->value()->callback( *this );	    ostr_ << ',';	    printSignMask(ostr_,cast_,self->value()->width());	    ostr_ << ')';	    break;	  case Expression::CastUnsigned:	    break;	  }      }      ////////////////////////////////////      void trap(const Binary* self)      {	switch( self->operation() )	  {	  case Expression::ArithmeticMultiply:	  case Expression::ArithmeticDivide:	  case Expression::ArithmeticModulus:	  case Expression::ArithmeticAdd:	  case Expression::ArithmeticMinus:	    ostr_ << '(';	    /*	      if( self->width()!=self->left()->width() )	      {	      ostr_ << '(';	      printCast(ostr_,self->width());	      ostr_ << ')';	      }	    */	    ostr_ << '(';	    printCast(ostr_,cast_);	    ostr_ << ')';	    	    self->left()->callback( *this );	    switch( self->operation() )	      {	      case Expression::ArithmeticMultiply:		ostr_ << '*';		break;	      case Expression::ArithmeticDivide:		ostr_ << '/';		break;	      case Expression::ArithmeticModulus:		ostr_ << '%';		break;	      case Expression::ArithmeticAdd:		ostr_ << '+';		break;	      case Expression::ArithmeticMinus:		ostr_ << '-';		break;	      }	    /*	      if( self->width()!=self->right()->width() )	      {	      ostr_ << '(';	      printCast(ostr_,self->width());	      ostr_ << ')';	      }	    */	    ostr_ << '(';	    printCast(ostr_,cast_);	    ostr_ << ')';	    	    self->right()->callback( *this );	    ostr_ << ')';	    break;	    	    	  case Expression::BitwiseXOR:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << '^';	    self->right()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::BitwiseAND:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << '&';	    self->right()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::BitwiseOR:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << '|';	    self->right()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::BitwiseNOR:	    ostr_ << "((~(";	    self->left()->callback( *this );	    ostr_ << '|';	    self->right()->callback( *this );	    ostr_ << "))";	    ostr_ << "&";	    printMask(ostr_,self->width(),self->width()-1,0);	    ostr_ << ')';	    break;	  case Expression::BitwiseNXOR:	    ostr_ << "((~(";	    self->left()->callback( *this );	    ostr_ << '^';	    self->right()->callback( *this );	    ostr_ << "))";	    ostr_ << "&";	    printMask(ostr_,self->width(),self->width()-1,0);	    ostr_ << ')';	    break;	    	    	  case Expression::LeftShift:	    ostr_ << "((";	    self->left()->callback( *this );	    ostr_ << "<<";	    self->right()->callback( *this );	    ostr_ << ')';	    //	    ostr_ << "&";	    //	    printMask(ostr_,self->width(),self->width()-1,0);	    ostr_ << ')';	    break;	  case Expression::RightShift:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << ">>";	    self->right()->callback( *this );	    ostr_ << ')';	    break;	    	    	  case Expression::LogicalEquality:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << "==";	    self->right()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::LogicalInequality:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << "!=";	    self->right()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::LogicalOR:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << "||";	    self->right()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::LogicalAND:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << "&&";	    self->right()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::LessThan:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << "<";	    self->right()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::GreaterThan:	    ostr_ << '(';	    self->left()->callback( *this );	    ostr_ << ">";	    self->right()->callback( *this );	    ostr_ << ')';	    break;	  case Expression::LessEqual:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91.com视频| 国产91对白在线观看九色| 91久久香蕉国产日韩欧美9色| 国产色婷婷亚洲99精品小说| 久久er99精品| 久久在线观看免费| 国产91色综合久久免费分享| 国产精品美女www爽爽爽| 94色蜜桃网一区二区三区| 综合久久国产九一剧情麻豆| 色呦呦一区二区三区| 亚洲成人黄色影院| 精品国产91乱码一区二区三区 | 亚洲女人****多毛耸耸8| 97精品视频在线观看自产线路二| 亚洲黄色性网站| 91精品久久久久久久99蜜桃 | 亚洲综合视频在线观看| 国产亚洲欧洲997久久综合 | 91国产免费看| 日韩影院精彩在线| 久久午夜羞羞影院免费观看| www.亚洲色图.com| 三级欧美在线一区| 国产视频一区不卡| 欧美日韩精品一区二区三区四区| 经典三级视频一区| 一区二区三区产品免费精品久久75| 欧美美女黄视频| 成人手机在线视频| 免费在线看一区| 亚洲四区在线观看| 日韩一区和二区| 成人国产精品免费| 日本aⅴ精品一区二区三区| 国产亚洲一二三区| 91麻豆精品国产91久久久资源速度| 国产米奇在线777精品观看| 亚洲欧美日韩中文播放| 日韩精品资源二区在线| 91在线视频观看| 国产成人免费视频网站| 亚洲成人免费看| 中日韩免费视频中文字幕| 91精品国产高清一区二区三区蜜臀 | 国产日韩精品一区| 欧美肥胖老妇做爰| 99re6这里只有精品视频在线观看| 色综合久久久网| 国产乱码字幕精品高清av| 亚洲午夜久久久久久久久久久 | 成人精品电影在线观看| 奇米四色…亚洲| 亚洲国产综合人成综合网站| 国产精品国产三级国产aⅴ中文| 精品日韩欧美在线| 日韩一区二区三区在线视频| 欧美性欧美巨大黑白大战| 成人免费av网站| 国产激情91久久精品导航| 日韩电影免费在线看| 午夜欧美在线一二页| 亚洲欧美福利一区二区| 亚洲国产精品精华液2区45| 欧美电影免费观看高清完整版在线| 91激情在线视频| 91在线视频在线| 色综合亚洲欧洲| 97se狠狠狠综合亚洲狠狠| 不卡一区二区三区四区| 成人午夜av影视| 波多野结衣中文字幕一区| 国产精品18久久久| 国产成人在线观看免费网站| 黄色日韩网站视频| 国产激情偷乱视频一区二区三区| 狠狠色丁香婷综合久久| 国产在线观看一区二区| 国产真实精品久久二三区| 国产乱一区二区| 国产精品一区二区三区99| 国产成人夜色高潮福利影视| 国产福利视频一区二区三区| 国产91精品一区二区麻豆网站| 国产一区欧美一区| 成人av电影在线播放| av一区二区久久| 欧美丝袜丝nylons| 欧美精品v日韩精品v韩国精品v| 欧美日韩国产小视频在线观看| 在线一区二区三区四区| 欧美日韩国产区一| 欧美一区二区三区视频在线| 欧美videos中文字幕| 久久欧美一区二区| 中文字幕在线不卡视频| 国产99精品在线观看| 99国产精品久久久久久久久久 | 国产三级精品视频| 国产精品久久久久久福利一牛影视 | 欧美色国产精品| 91精品国产色综合久久不卡蜜臀 | 日韩精品亚洲专区| 久久se这里有精品| 99精品欧美一区| 欧美日韩一级二级三级| 日韩欧美一区二区久久婷婷| 国产欧美日本一区视频| 一区二区日韩电影| 久久精品久久综合| 成人av网站在线观看免费| 欧美三级电影一区| 精品久久五月天| 亚洲精品国产高清久久伦理二区| 亚洲午夜激情av| 国产一区二区0| 欧美无砖专区一中文字| 欧美电影免费观看高清完整版在 | 国产精品欧美一区喷水| 樱花影视一区二区| 精品一区二区三区在线播放 | 国产成人亚洲综合a∨猫咪| 91免费在线视频观看| 欧美一区二区三区播放老司机| 国产日产精品1区| 亚洲bt欧美bt精品| 99re热视频精品| 日韩精品最新网址| 亚洲福中文字幕伊人影院| 国产黄色成人av| 欧美一区二区三区日韩| 国产精品久久久久久久久晋中| 麻豆视频一区二区| 91免费看`日韩一区二区| 2023国产精品| 偷拍一区二区三区四区| 色婷婷国产精品久久包臀| 久久久久久97三级| 蜜桃视频在线观看一区| 在线免费观看日韩欧美| 国产精品久久久久久户外露出 | 国产午夜亚洲精品午夜鲁丝片| 亚洲免费在线观看| 国产精品538一区二区在线| 欧美一区二区三区日韩视频| 亚洲精品欧美综合四区| 成人黄色在线网站| 久久免费看少妇高潮| 日韩精品一二三| 欧美日韩免费一区二区三区视频 | 精品卡一卡二卡三卡四在线| 亚洲午夜av在线| 欧美亚州韩日在线看免费版国语版| 中文在线一区二区| 国产成人av影院| 国产喂奶挤奶一区二区三区| 韩国精品主播一区二区在线观看| 91精品国产入口| 日韩成人一区二区三区在线观看| 色噜噜狠狠色综合欧洲selulu| 国产精品久久久久aaaa樱花| 国产精品一区一区| 国产偷国产偷亚洲高清人白洁| 久久99九九99精品| 91精品国产免费| 另类欧美日韩国产在线| 3d动漫精品啪啪一区二区竹菊| 午夜欧美2019年伦理| 777色狠狠一区二区三区| 天堂va蜜桃一区二区三区| 欧美视频一区在线观看| 亚洲高清久久久| 337p亚洲精品色噜噜狠狠| 无吗不卡中文字幕| 91精品一区二区三区在线观看| 亚洲h在线观看| 精品美女在线观看| 国产露脸91国语对白| 国产精品伦理在线| 91在线视频在线| 亚洲图片欧美色图| 91精品国产高清一区二区三区| 日韩午夜激情av| 日韩精品中午字幕| 亚洲不卡在线观看| 亚洲人成7777| 在线免费不卡视频| 丝袜亚洲另类欧美综合| 日韩一区国产二区欧美三区| 国产美女在线精品| 亚洲美女淫视频| 欧美日韩第一区日日骚| 国产精品主播直播| 国产精品久久二区二区| 一道本成人在线| 老司机免费视频一区二区三区| 欧美午夜精品久久久久久孕妇| 国产精品美女久久久久高潮| 99久久婷婷国产| 午夜精品一区二区三区免费视频 |