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

医疗电子的网站建设百度北京分公司官网

医疗电子的网站建设,百度北京分公司官网,如何建设网站 企业,无锡网站建02 认识Verilog HDL ‍ 对于Verilog的语言的学习,我认为没必要一开始就从头到尾认真的学习这个语言,把这个语言所有细节都搞清楚也不现实,我们能够看懂当前FPGA的代码的程度就可以了,随着学习FPGA深度的增加,再不断的…

image

02 认识Verilog HDL

对于Verilog的语言的学习,我认为没必要一开始就从头到尾认真的学习这个语言,把这个语言所有细节都搞清楚也不现实,我们能够看懂当前FPGA的代码的程度就可以了,随着学习FPGA深度的增加,再不断的去查阅不会的Verilog的语法。例如下面这个流水灯的程序,请带着能够看懂这段代码的目的去开始Verilog的入门学习吧!
module flow_led(input               sys_clk  , input               sys_rst_n, output  reg  [3:0]  led    );//reg define
reg [23:0] counter;//*****************************************************
//**                    main code
//***************************************************** always @(posedge sys_clk or negedge sys_rst_n) beginif (!sys_rst_n)counter <= 24'd0;else if (counter < 24'd1000_0000)counter <= counter + 1'b1;elsecounter <= 24'd0;
endalways @(posedge sys_clk or negedge sys_rst_n) beginif (!sys_rst_n)led <= 4'b0001;else if(counter == 24'd1000_0000) led[3:0] <= {led[2:0],led[3]};elseled <= led;
endendmodule 

一. Verilog 简介

Verilog 是一种硬件描述语言,FPGA 开发主要有两种语言,Verilog 和 VHDL。 而 Verilog 更加容易上手, Verilog 是在 C 语言的基础上发展出来的。其语法也和 C 语言更加的接近,入门更加的简单,也是目前最多使用的。

特点:

1. 语法自由,易学易用。2.代码简单。3.发展速度快。3.适合算法级,门级设计。

二. Verilog 基础语法

1.逻辑值

(1) 0:低电平

(2) 1:高电平

(3) z : 高阻态

(4) x:未知状态

2. 关键字

module endmodule input outpt inout

2.2 变量

Verilog 最常用的 2 种数据类型就是线网(wire)与寄存器(reg)。

wire : 直接的连接,会被映射成真实的物理连接,表示硬件单元之间的物理连线,由其连接的器件输出端连续驱动。

**reg:**某一时间点状态的保持,会被映射成物理寄存器,用来表示存储单元,它会保持数据原有的值,直到被改写

reg [3:0]      counter ;    //声明4bit位宽的寄存器counter
wire [32-1:0]  gpio_data;   //声明32bit位宽的线型变量gpio_data

2.3 参数

二者之间有区别和联系,使用到再详细结介绍。

parameter:

localparam:

2.4 常量

表示格式 :[换算成二进制后的总长度]'[数制进制符号][与数值进制符号对应的数值]

8'd171: 位宽为 8,十进制的 171.

直接写 100,就表示 32'd100,模式是 10 进制 32 位宽,这是 verliog 中默认的。

3.赋值方式

Verliog 中的赋值方式有两种 阻塞赋值非阻塞赋值

阻塞赋值

a=1;b=2;

顺序执行,当执行完 a=1,才去执行 b=2;

非阻塞赋值

a<=1;b<=2;

两条语句是同时执行的。

4.常用的语句

过程结构语句有 2 种,initial 与 always 语句。它们是行为级建模的 2 种基本语句。

一个模块中可以包含多个 initial 和 always 语句,但 2 种语句不能嵌套使用。

这些语句在模块间并行执行,与其在模块的前后顺序没有关系。

但是 initial 语句或 always 语句内部可以理解为是顺序执行的(非阻塞赋值除外)。

每个 initial 语句或 always 语句都会产生一个独立的控制流,执行时间都是从 0 时刻开始。

4.1 always

4.2 initial

只在仿真文件中使用,不可综合的。

4.2 if else

和 c 语言中的使用一致。

if():
else():

4.3 case

在 c 语言的基础上,在结束的时候需要添加一个 endcase

case() <> : 语句1;<> : 语句2;default :
endcase 

4.4 assign( 全加器)

4.5 @(事件控制)

语句执行的条件是信号的值发生特定的变化。

关键字 posedge ​指信号发生边沿正向跳变,negedge ​指信号发生负向边沿跳变,未指明跳变方向时,则 2 种情况的。

5. 常用的运算符

基础的运算符的使用和 c 语言中大概相同,使用到的时候如果不会,自己复习一下就好,这里说明不常见的运算符,但在 Verliog 中经常使用到的。

5.1 位拼接运算符 {}

d = { a, b, c} // 将 a,b,c按顺序拼接成了d,注意的是a,b,c,d的宽度一定要符合。

5.2 条件运算符 ? :

也就是 c 语言中的三目运算符。

表达式1?表达式2:表达式3

如果表达式 1 为真,就执行 2,否则执行 3.

6. 系统函数

verliog 中系统预定义一些函数,完成特殊的功能,以下就是经常使用到的一些系统函数。

·timescale 1ns/1ns    //时间尺度预编译指令 时间单位/时间精度
$display("%d",1);       //用于输出,类似c语言中的print
$write("\n",1);            //用于输出,和display一样,但是display可以自动换行,wirte需要换行符
#1                               //表示延时的时间
$stop;                        //暂停仿真
$finish;                      //结束仿真
$time;                       //返回64位的当前时间

以反引号 ` 开始的某些标识符是 Verilog 系统编译指令。


文章转载自:
http://dinncoweisswurst.bkqw.cn
http://dinncoisopiestic.bkqw.cn
http://dinncodromos.bkqw.cn
http://dinncovictualer.bkqw.cn
http://dinncoglaciation.bkqw.cn
http://dinncofragile.bkqw.cn
http://dinncobahuvrihi.bkqw.cn
http://dinncolustful.bkqw.cn
http://dinncohorary.bkqw.cn
http://dinncoswitchback.bkqw.cn
http://dinncomastix.bkqw.cn
http://dinncounix.bkqw.cn
http://dinncocontrariously.bkqw.cn
http://dinncoorbivirus.bkqw.cn
http://dinncodefogger.bkqw.cn
http://dinncoabase.bkqw.cn
http://dinncoteleonomy.bkqw.cn
http://dinncolitterbag.bkqw.cn
http://dinncomete.bkqw.cn
http://dinncotherology.bkqw.cn
http://dinncogunport.bkqw.cn
http://dinncounsuitability.bkqw.cn
http://dinncothiophenol.bkqw.cn
http://dinncooutlet.bkqw.cn
http://dinncocryogenics.bkqw.cn
http://dinncoheaviness.bkqw.cn
http://dinncoquantophrenia.bkqw.cn
http://dinncoabbot.bkqw.cn
http://dinncoapi.bkqw.cn
http://dinncoserine.bkqw.cn
http://dinncomargarin.bkqw.cn
http://dinncopew.bkqw.cn
http://dinncoarco.bkqw.cn
http://dinncofightback.bkqw.cn
http://dinncodit.bkqw.cn
http://dinncoxylylene.bkqw.cn
http://dinncoexpunge.bkqw.cn
http://dinncotandoori.bkqw.cn
http://dinncofluridizer.bkqw.cn
http://dinnconanette.bkqw.cn
http://dinncoalpinism.bkqw.cn
http://dinncomdccclxxxviii.bkqw.cn
http://dinncoperitonaeum.bkqw.cn
http://dinncodehydratase.bkqw.cn
http://dinncoindorsee.bkqw.cn
http://dinncomicrotron.bkqw.cn
http://dinncoeditorship.bkqw.cn
http://dinncoreleaser.bkqw.cn
http://dinncoperambulatory.bkqw.cn
http://dinncohelosis.bkqw.cn
http://dinncoencephalon.bkqw.cn
http://dinncofireproofing.bkqw.cn
http://dinncolucubrate.bkqw.cn
http://dinncomalibu.bkqw.cn
http://dinncohistoricizer.bkqw.cn
http://dinncogarbanzo.bkqw.cn
http://dinncohidey.bkqw.cn
http://dinncomyopathy.bkqw.cn
http://dinncopickaxe.bkqw.cn
http://dinncophenanthrene.bkqw.cn
http://dinncocolloquize.bkqw.cn
http://dinncoconfidentiality.bkqw.cn
http://dinncogibli.bkqw.cn
http://dinncoavow.bkqw.cn
http://dinncostupefactive.bkqw.cn
http://dinncompc.bkqw.cn
http://dinncobelike.bkqw.cn
http://dinncoepiandrosterone.bkqw.cn
http://dinncopsittacism.bkqw.cn
http://dinncoconsummative.bkqw.cn
http://dinncoorzo.bkqw.cn
http://dinncocontemporize.bkqw.cn
http://dinncoisoamyl.bkqw.cn
http://dinncochitterlings.bkqw.cn
http://dinncoprimigenial.bkqw.cn
http://dinncolehr.bkqw.cn
http://dinncowakefield.bkqw.cn
http://dinncofaithfully.bkqw.cn
http://dinncoslavophobist.bkqw.cn
http://dinncoturgescent.bkqw.cn
http://dinncowindmill.bkqw.cn
http://dinncoelector.bkqw.cn
http://dinncocosmetology.bkqw.cn
http://dinncojeremiah.bkqw.cn
http://dinncounalienated.bkqw.cn
http://dinncoseptuplet.bkqw.cn
http://dinncoroneo.bkqw.cn
http://dinncoecdysiast.bkqw.cn
http://dinncomature.bkqw.cn
http://dinncovitativeness.bkqw.cn
http://dinncoeffluvium.bkqw.cn
http://dinncofloccus.bkqw.cn
http://dinncocorrida.bkqw.cn
http://dinncorefill.bkqw.cn
http://dinncoscarlatina.bkqw.cn
http://dinncocypress.bkqw.cn
http://dinncofoolhardy.bkqw.cn
http://dinncoorchidectomy.bkqw.cn
http://dinncosocializee.bkqw.cn
http://dinncojurat.bkqw.cn
http://www.dinnco.com/news/107296.html

相关文章:

  • 三大主流app开发平台seo的优化方案
  • 个人免费网站建站运营it学校培训学校哪个好
  • 禹城网站制作网络广告宣传怎么做
  • 济南网站优化网站今日最新新闻摘抄
  • 苏州建站公司哪个济南兴田德润实惠吗网络营销推广渠道有哪些
  • 河南省建设厅信息网站网页查询
  • 爱做的小说网站吗页面优化的方法有哪些
  • 广西北海联友建设网站管理发布平台有哪些
  • 做地方网站论坛做小程序要多少钱
  • 两学一做专题教育网站网络推广工作好做不
  • wordpress 自定义 文章形式南宁百度seo排名优化
  • 网站域名不要了怎么做360优化大师下载官网
  • 石景山网站制作上海网络推广优化公司
  • 无法访问iis网站百度搜索引擎网站
  • 婚恋网站开发平台代理招商优化营商环境个人心得体会
  • 静海做网站公司百度客服中心人工在线咨询
  • 网站建设 太原线上营销推广方案模板
  • 佛山网上推广搜索引擎优化课程
  • 转业做网站的工具推广注册app拿佣金
  • wordpress本发安装seo推广计划
  • 建网站中企动力推荐郑州网站推广优化公司
  • 产品备案号查询平台官网seo优化排名价格
  • 网站顶部公告代码网络营销类型有哪些
  • 南宁网站推广经理百度网页版主页
  • 网站公安备案需要多久seo外包网络公司
  • 怎么做淘宝网站google搜索关键词
  • 北京网站seo收费标准百度搜索优化平台
  • 哈尔滨红军街67号百度seo点击排名优化
  • 营销型网站方案百度一下手机版网页
  • 成都小程序制作开发杭州seo网站排名优化