当前位置:网站首页>【SystemVerilog 之 过程块和方法】~ 域、always过程块、initial过程块、函数 function、任务 task、生命周期
【SystemVerilog 之 过程块和方法】~ 域、always过程块、initial过程块、函数 function、任务 task、生命周期
2022-06-11 14:19:00 【AI很不错呦】
1. 过程块
1.1 什么是 域?
在SV中,为了区分硬件设计和软件的世界,我们将定义的软件变量或者例化的硬件所在的空间称之为 “域”。
1.2 always过程块
always是为了描述硬件的行为,需要注意的是,它有两种使用方式===>
- 用于时序逻辑电路描述:敏感信号列表应该出现的是 时钟信号。
- 用于组合逻辑电路描述:敏感信号列表没有时钟信号。
always中的@(event)敏感列表是为了描述硬件信号的触发行为。
以下四项哪些是正确使用always的方式?
正确答案:ABC
解释:A,时序逻辑;B,组合逻辑或锁存器;C,并行执行;D,不可以初始化,初始化发生在initial或者定义变量的时候。
1.3 initial过程块
initial是软件执行的方式,只执行一次。

2. 方法
2.1 函数 function


2.2 任务 task

2.2.1 练习

上边是自定义一个结构体,之后使用函数实现了一个拷贝的功能。
上边是进行初始化,首先声明结构体变量s,t;之后对内的变量赋值;调用函数实现s向t的拷贝;最后修改t中cmd参数的值。
问题:变量t中三个成员的最后值为多少?
到这里,我相信对于小白来说,肯定这么认为:s赋初值,复制给t,t就改变了cmd参数,最后肯定为{‘h2,’h10,‘h100},完事,简简单单!!!
仔细想想对吗?这里遗漏了一个重要的知识点,那就是对于函数function中参数定义是输出呢?还是输入呢?这里没有写,默认都是输入,所以,函数拷贝完之后根本没有返回值,所以最后失去了拷贝的功能,则t就是{0,0,0},有效操作就是t.cmd = 'h2,所以,最后答案是{'h2,'h0,'h0}。
2.3 对于function和task使用建议

3. 生命周期

3.1 例证



3.2 面试高频题

答案:ABCD
学习 设计例化和连接 等相关的知识。
希望我可以坚持下去,不断学习!如果觉得有用,希望关注点赞评论,不迷路!!!
声明:仅供学习参考,侵删!!!
参考文献
网络资源ppt
边栏推荐
- In depth research and analysis report on global and Chinese spray drying machinery market
- Is bone conduction earphone good for bone? Is bone conduction earphone harmful to the body?
- 架构概念探索:以开发纸牌游戏为例
- [Clickhouse column] user initialization of new library role
- Repository Manager之Nexus
- Xiaomi 9-wire brush ROM
- In depth research and analysis report on global and Chinese hydrogen fuel station market
- 2022-2028 near infrared (NIR) analyzer Market Status and future development trend in the world and China
- Cartoon: interesting "cake cutting" problem
- Zhejiang University has developed a UAV, which can automatically avoid obstacles and walk through the woods like a bird. The real swarm is coming
猜你喜欢

111. minimum depth of binary tree

Zhu Ping: in the post epidemic era, medical beauty operations should not only be distracted, but also reverse the routine

. Net C Foundation (6): namespace - scope with name
![[pyhton crawler] regular expression](/img/d3/578514b2d19d5f4ed246a33a333d14.jpg)
[pyhton crawler] regular expression

漫画:有趣的 “切蛋糕“ 问题

Is bone conduction earphone good for bone? Is bone conduction earphone harmful to the body?

强大的全文本搜索工具——AnyTXT Searcher

Live800:智能客服提升客户体验的几种方式

CVPR 2022 | 神经辐射场几何编辑方法NeRF-Editing

Live800: several ways for intelligent customer service to improve customer experience
随机推荐
Easyexcel configuration and Application
PowerShell主架构师:我用业余时间开发项目,表现优秀反而被微软降级了
CVPR 2022 | neural radiation field geometry editing method nerf editing
Ali, tell me about the application scenarios of message oriented middleware?
Determine whether a string contains the specified string (verified)
Summary of some classic embedded C interview questions
架构概念探索:以开发纸牌游戏为例
couldn‘t upgrade db schema: insert into ACT_GE_PROPERTY values (‘common.sche[已解决]
Alibaba Cloud 3 (Soaring Falcon) x86_ 64 (py3.7.8) system Yum source
非常值得学习的调度开源库推荐
Leetcode 1963. 使字符串平衡的最小交换次数(学习)
Xiaomi 9-wire brush ROM
Redis uses 10 tips, please accept!
一些经典的嵌入式C面试题汇总
[public class preview]: mxplayer Ott audio and video transcoding practice and optimization
sqlmap检测SQL-lab靶场
System. out. What should I pay attention to when using the println () method
Invalid bound statement (not found) error [resolved]
[team learning] task06:for, if, and while
In depth research and analysis report on global and Chinese gas monitor market