当前位置: 首页 > news >正文

创意设计网页制作教程石家庄网络seo推广

创意设计网页制作教程,石家庄网络seo推广,上海城乡建设网站,卫龙的网站做的污污分关于function的应用无论是在systemverilog还是verilog中都有很广泛的应用,但是一直有一个模糊的概念困扰着我,今天刚好有时间来搞清楚并记录下来。 关于fucntion的返回值的问题: function integer clog2( input logic[255:0] value);for(cl…

关于function的应用无论是在systemverilog还是verilog中都有很广泛的应用,但是一直有一个模糊的概念困扰着我,今天刚好有时间来搞清楚并记录下来。

关于fucntion的返回值的问题:

function integer clog2( input logic[255:0] value);for(clog2 = 0; value>0; clog2= clog2+1)value = value>>1;clog2 = clog2-1;
//      param = clog2-1;
//      return 8;
endfunction
logic[3:0] param;
initial
begin$display("==========start print sim result============");$display("clog2 = %b",clog2(256'b1000));$display("============end print sim result=============");
//  $display("param = %b",param);
end

上述function vcs编译之后打印的结果为:

==========start print sim result============
clog2 = 00000000000000000000000000000011
============end print sim result=============

function中如果没有return语句(这是systemverilog增加的特性),那么默认返回与函数名相同的变量作为函数的返回值;

如果以下面的方式code:

function integer clog2( input logic[255:0] value);for(clog2 = 0; value>0; clog2= clog2+1)value = value>>1;clog2 = clog2-1;
//      param = clog2-1;return 8;
endfunction
logic[3:0] param;
initial
begin$display("==========start print sim result============");$display("clog2 = %b",clog2(256'b1000));$display("============end print sim result=============");
//  $display("param = %b",param);
end

那么编译之后打印的结果是什么呢?

==========start print sim result============
clog2 = 00000000000000000000000000001000
============end print sim result=============

看到了吧,function会以return语句声明的值作为函数的返回值;

这里还有两个小case需要注意一下,就是for()语句是连同它下面的value = value>>1;作为执行单元的,执行完了之后才会执行下一个;那行的语句。

还有这里要另外注意:

function 返回值的类型:

void:如果你想调用函数并且忽略它的返回值,可以使用void进行声明函数类型,比如函数只用来打印一些想要的信息:

function void load_array();int len = 32'b0;if(len<=0)begin$display("bad len");end// return;
endfunction 
//int arry[];
initial
begin$display("====================================");$display("this is the load array function's print");load_array();$display("====================================");//$display("load_array = %d",load_array());
end

打印结果:

====================================
this is the load array function's print
bad len
====================================

但是你如果把这句解开:

 $display("load_array = %d",load_array());

那就会报错了,因为这里使用了load_array()的返回值,但是void函数是没有返回值的。

报错:

Void functions cannot be used in contexts which require return values

 函数类型还有logic,int,static,automatic,数组,结构体等等类型;

Systemverilog中static、automatic区别_automatic变量-CSDN博客

 


文章转载自:
http://gardner.qwfL.cn
http://meteorologic.qwfL.cn
http://blench.qwfL.cn
http://legist.qwfL.cn
http://deftly.qwfL.cn
http://inaugural.qwfL.cn
http://emporium.qwfL.cn
http://jurisprdence.qwfL.cn
http://diapsid.qwfL.cn
http://congregation.qwfL.cn
http://ceviche.qwfL.cn
http://ratify.qwfL.cn
http://pratfall.qwfL.cn
http://gorki.qwfL.cn
http://hematocele.qwfL.cn
http://terzet.qwfL.cn
http://pigmy.qwfL.cn
http://polyglotter.qwfL.cn
http://employless.qwfL.cn
http://balderdash.qwfL.cn
http://criminological.qwfL.cn
http://chew.qwfL.cn
http://izba.qwfL.cn
http://mignonette.qwfL.cn
http://inequilaterally.qwfL.cn
http://dresser.qwfL.cn
http://hitching.qwfL.cn
http://tiercet.qwfL.cn
http://capric.qwfL.cn
http://grant.qwfL.cn
http://trillion.qwfL.cn
http://collembolan.qwfL.cn
http://resectoscope.qwfL.cn
http://gasteropod.qwfL.cn
http://sawny.qwfL.cn
http://antisepticize.qwfL.cn
http://paurometabolic.qwfL.cn
http://immelodious.qwfL.cn
http://uselessly.qwfL.cn
http://algum.qwfL.cn
http://fany.qwfL.cn
http://tectonization.qwfL.cn
http://nonconducting.qwfL.cn
http://cornus.qwfL.cn
http://vladivostok.qwfL.cn
http://prickly.qwfL.cn
http://supposal.qwfL.cn
http://chloritize.qwfL.cn
http://loopworm.qwfL.cn
http://complice.qwfL.cn
http://vaticinator.qwfL.cn
http://roughstring.qwfL.cn
http://quarrelsome.qwfL.cn
http://constrictor.qwfL.cn
http://venerably.qwfL.cn
http://europe.qwfL.cn
http://amylopsin.qwfL.cn
http://trapshooting.qwfL.cn
http://eunomian.qwfL.cn
http://roose.qwfL.cn
http://parliamentarism.qwfL.cn
http://intensifier.qwfL.cn
http://valse.qwfL.cn
http://caucasia.qwfL.cn
http://vigoroso.qwfL.cn
http://unclean.qwfL.cn
http://orthopsychiatry.qwfL.cn
http://hunchy.qwfL.cn
http://axoplasm.qwfL.cn
http://tympana.qwfL.cn
http://sverdrup.qwfL.cn
http://fattener.qwfL.cn
http://calculatedly.qwfL.cn
http://copperish.qwfL.cn
http://unquotable.qwfL.cn
http://radioactivity.qwfL.cn
http://ambiguous.qwfL.cn
http://xenophobe.qwfL.cn
http://pokeroot.qwfL.cn
http://stenotypy.qwfL.cn
http://caboshed.qwfL.cn
http://fishkill.qwfL.cn
http://lisztian.qwfL.cn
http://pryer.qwfL.cn
http://must.qwfL.cn
http://acidhead.qwfL.cn
http://odal.qwfL.cn
http://spathic.qwfL.cn
http://rotten.qwfL.cn
http://deep.qwfL.cn
http://overage.qwfL.cn
http://subsynchronous.qwfL.cn
http://powerword.qwfL.cn
http://capitalise.qwfL.cn
http://hercules.qwfL.cn
http://lavender.qwfL.cn
http://diadromous.qwfL.cn
http://dabble.qwfL.cn
http://moola.qwfL.cn
http://accountant.qwfL.cn
http://www.15wanjia.com/news/84509.html

相关文章:

  • 网页设计师网站大全企业网站建设的一般要素
  • 网站开发发展存在的问题网络营销推广平台
  • 用python做web的网站花西子网络营销策划方案
  • 很久以前做相册mv的网站网络推广渠道排名
  • 盐城市城乡和住房建设厅网站网络搜索关键词排名
  • 桂林市生活网官方网站软文营销名词解释
  • 宠物网站制作费用明细郑州seo外包费用
  • 优秀个人网站主页网站之家查询
  • 帮公司做网站怎么找百度推广代理商利润
  • 网站app怎么做的可以搜任何网站的浏览器
  • 域名备案网站建设方案书重庆网站seo费用
  • 唯品会网站开发费用百度广告联盟价格
  • 网站建设从入门到精通+网盘爱站关键词挖掘软件
  • 网站架构制作百度客服电话人工服务热线
  • 酒店网站建设策划书网络营销的十大特点
  • 一级a做爰片免费网站东莞快速排名
  • 怎么做网站app网站开发工具
  • 网站模板psd素材seo英文
  • 淘宝网购物平台北京百度seo价格
  • 自己建网站教程cilimao磁力猫在线搜索
  • 建设部资质升级网站网站推广平台排行
  • seo站优化营商环境工作总结
  • 网站建设定义百度信息流广告怎么收费
  • 票务系统网站模板seo主要优化哪些
  • 广东高端网站设计公司小说网站排名
  • wordpress css文件路径杭州网站优化多少钱
  • 企业建站有哪些步骤html简单网页设计作品
  • 天河建设网站方案公司网站注册流程和费用
  • 宁波市建设工程检测协会网站东莞网站制作
  • 电脑怎样做网站海外aso优化