SystemVerilog笔记——Arrays

Static Arrays(Packed Arrays and Unpacked Arrays)

Dynamic Arrays

Associative Arrays

Queues

Static Arrays

1. 一维合并数组

2. 多维合并数组

例一:二维合并数组(32bit或4byte)

例二:三维合并数组(3个32bit)

 

 Unpacked Arrays

1. 一维非合并数组

2. 多维非合并数组

初始化遍历多维数组时,应当写成foreach(stack[i,j]) 

3. 多维合并+非合并数组

 Dynamic Arrays

 基本语法

符号:[]   new()分配大小并作初始化

 

 动态数组方法(函数)

FunctionDescription
function int size ();Returns the current size of the array, 0 if array has not been created
function void delete ();Empties the array resulting in a zero-sized array

为动态数组添加新的数值

 id.size+1意味着将array的位数扩展一位

 Associative Arrays

基本语法

 关联数组方法(函数)

FunctionDescription
function int num ();Returns the number of entries in the associative array
function int size ();Also returns the number of entries, if empty 0 is returned
function void delete ( [input index] );index when specified deletes the entry at that index, else the whole array is deleted
function int exists (input index);Checks whether an element exists at specified index; returns 1 if it does, else 0
function int first (ref index);Assigns to the given index variable the value of the first index; returns 0 for empty array
function int last (ref index);Assigns to given index variable the value of the last index; returns 0 for empty array
function int next (ref index);Finds the smallest index whose value is greater than the given index
function int prev (ref index);Finds the largest index whose value is smaller than the given index

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SystemVerilog是一种硬件描述语言(HDL),用于设计和验证数字电路。SystemVerilog具有丰富的特性,适用于各种设计和验证任务。以下是SystemVerilog入门笔记的一些重点内容。 首先,了解SystemVerilog的基本语法是很重要的。SystemVerilog继承了Verilog的语法,同时加入了一些额外的特性,如数据类型、类和接口等。熟悉这些语法规则对于编写有效的代码至关重要。 其次,了解模块和端口的概念。SystemVerilog中的模块是最基本的构建单元,而端口则是模块与外部环境之间的接口。了解如何定义和使用模块和端口是编写可重用代码的关键。 另外,掌握数据类型和运算符是必不可少的。SystemVerilog支持多种数据类型,如整数、浮点数、逻辑值等,同时也提供了丰富的运算符,如加法、减法、逻辑运算符等。这些知识对于设计和验证数字电路非常重要。 此外,了解时序控制和并发控制是必要的。SystemVerilog提供了多种时序控制和并发控制的语法和特性,如always块、initial块和fork/join语句等。掌握这些知识对于设计复杂的数字电路至关重要。 最后,了解Verilog验证中的一些基本概念也是很重要的。例如,了解如何使用assert语句进行断言检查、如何使用coverage语句进行覆盖率分析等。 总之,SystemVerilog入门需要掌握其基本语法、模块和端口、数据类型和运算符、时序控制和并发控制,以及一些基本的验证概念。这些知识是成为一名合格的SystemVerilog工程师所必备的基础。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值