4.2.1 Vector bit-select and part-select addressing
Frm:IEEE Std 1364™-2001, IEEE Standard Verilog® Hardware Description Language
Bit-selects extract a particular bit from a vector net, vector reg, integer variable, or time variable. The bit can be addressed using an expression. If the bit-select is out of the address bounds or the bit-select is x or z, then the value returned by the reference shall be x. The bit-select or part-select of a variable declared as real or realtime shall be considered illegal.
Several contiguous bits in a vector net, vector reg, integer variable, or time variable can be addressed and are known as part-selects. There are two types of part-selects, a constant part-select and an indexed part-select.
A constant part-select of a vector reg or net is given with the following syntax:
vect[msb_expr:lsb_expr]
Both expressions shall be constant expressions. The first expression has to address a more significant bit than the second expression. If the part-select is out of the address bounds or the part-select is x or z, then the value returned by the reference shall be x.
An indexed part select of a vector net, vector reg, integer variable, or time variable is given with the following syntax:
reg [:] big_vect;
reg [:] little_vect; big_vect[lsb_base_expr +: width_expr]
little_vect[msb_base_expr +: width_expr] big_vect[msb_base_expr -: width_expr]
little_vect[lsb_base_expr -: width_expr]
The width_expr shall be a constant expression. It also shall not be affected by run-time parameter assignments. The lsb_base_expr and msb_base_expr can vary at run-time. The first two examples select bits starting at the base and ascending the bit range. The number of bits selected is equal to the width expression. The second two examples select bits starting at the base and descending the bit range. Part-selects that address a range of bits that are completely out of the address bounds of the net, reg, integer, or time, or when the part-select is x or z, shall yield the value x when read, and shall have no effect on the data stored when written.
Part-selects that are partially out of range shall when read return x for the bits that are out of range, and when written shall only affect the bits that are in range.
Examples:
module top;
`timescale 10ns/1ns reg [:] big_vect = 'h12345678;
reg [:] little_vect = 'h87654321;
reg [:] dword; integer sel;
initial
begin
# $display("1. big_vect = 0x%h, big_vect[0 +:8] is %h, and big_vect[7 -:8] is %h ", big_vect, big_vect[ +:], big_vect[ -:] ); if ( big_vect[ +:] == big_vect[ : ])begin $display(" big_vect[0 +:8] == big_vect[7 : 0]"); end
if (little_vect[ +:] == little_vect[ : ])begin $display("little_vect[0 +:8] == little_vect[0 : 7]"); end
if ( big_vect[ -:] == big_vect[ : ])begin $display(" big_vect[15 -:8] == big_vect[15 : 8]"); end
if (little_vect[ -:] == little_vect[ :])begin $display("little_vect[15 -:8] == little_vect[8 :15]"); end
if (sel > && sel < ) dword[*sel +:] = big_vect[:]; // Replace the byte selected. // 注意: big_vect[0:7] 引用错误,同理little_vect[15:8] 也是引用错误。
// if ( big_vect[0 +:8] == big_vect[0 : 7])begin end end endmodule
output:
# . big_vect = 0x12345678, big_vect[ +:] is , and big_vect[ -:] is
# big_vect[ +:] == big_vect[ : ]
# little_vect[ +:] == little_vect[ : ]
# big_vect[ -:] == big_vect[ : ]
# little_vect[ -:] == little_vect[ :]
4.2.1 Vector bit-select and part-select addressing的更多相关文章
- select count(*)和select count(1)
一般情况下,Select Count (*)和Select Count(1)两着返回结果是一样的 假如表沒有主键(Primary key), 那么count(1)比count(*)快, 如果有主键的話 ...
- select count(*)和select count(1)的区别
一般情况下,Select Count (*)和Select Count(1)两着返回结果是一样的 假如表沒有主键(Primary key), 那么count(1)比count(*)快, 如果有主键的話 ...
- 仅Firefox中A元素包含Select时点击Select不能选择option
这是在使用京东的一个日期组件时碰到的bug,重现bug的代码精简如下 <!DOCTYPE HTML> <html> <head> <title> 仅Fi ...
- string strSQL = "Select * From Employees;Select * from Customers";执行两次查询
SqlCommand对象的字符串SQL命令可以做多个,以查询为例,用到SqlDataReader的一些方法,如ExecuteReader(),Read()(一条命令内的移动至下一记录),NextRes ...
- select count(*)和select count(1)的区别 (转)
A 一般情况下,Select Count (*)和Select Count(1)两着返回结果是一样的 假如表沒有主键(Primary key), 那么count(1)比count(*)快, 如果有主键 ...
- 8.2.1.1 Speed of SELECT Statements 加速SELECT 语句
8.2.1 Optimizing SELECT Statements 8.2.2 Optimizing Data Change Statements 8.2.3 Optimizing Database ...
- 【SQL】INSERT INTO SELECT语句与SELECT INTO FROM语句
INSERT INTO SELECT语句与SELECT INTO FROM语句,都是将一个结果集插入到一个表中: #INSERT INTO SELECT语句 1.语法形式: Insert into T ...
- Go语言规格说明书 之 select语句(Select statements)
go version go1.11 windows/amd64 本文为阅读Go语言中文官网的规则说明书(https://golang.google.cn/ref/spec)而做的笔记,介绍Go语言的 ...
- 测试--错误java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=select], {ExactMatcher:fDisplayName=select(com.rjj.demo.DemoApplicationTests)]...
异常这个错误java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=select], {ExactMatche ...
- select 1 与 select null (转)
1.Select 1 在这里我主要讨论的有以下几个select 语句: table表是一个数据表,假设表的行数为10行,以下同. 1:select 1 from table 2:select cou ...
随机推荐
- 详解代理自动配置 PAC
转自知乎 最近一直在做跨域中华局域网的工作,了解了很多代理知识和基础概念,很零散,也很细碎.希望通过一段时间的学习,能够自由地穿梭在国际互联网和中华局域网之间.后续会写一系列文章记录我了解到的知识点, ...
- Windows下搭建Wampserver+Wordpress
安装wordpress windows 下载安装包 百度云 提取码:qxzp 安装wamp WampServer就是Windows Apache Mysql PHP集成安装环境,即在window下的a ...
- 2019 ACM-ICPC 南京 现场赛 K. Triangle (二分)
题意 给定一个三角形和一个点 \(p\),如果该点不在三角形边上直接输出 \(-1\),否则在三角形上找一点 \(q\),使得线段 \(pq\) 平分三角形面积. 思路 看完题想都没想直接二分了. 就 ...
- Locally weighted regression algorithm
之前所讨论的梯度下降算法,其算法模型是“线性回归模型”,我们可以理解为变量与因变量之间的关系是线性的.而现实情况是,使用线性模型去描述所有数据,很容易出现欠拟合(underfitting)的情况:同样 ...
- linux下安装JMeter(小白教程)
用windows平台测试时,会受到网络条件的影响,导致测试结果不够准确,尤其是高并发的情况下,需要能够精准的测试请求的响应时长,对于网络的要求更加苛刻.在这样的情况下,可以考虑在linux服务器端安装 ...
- ZABBIX 忘记登录密码
ZABBIX 忘记登录密码 摘要 有些童鞋会忘记zabbix的登陆密码,今天给大家写一篇找回登陆密码~ ZABBIX 忘记登录密码 zabbix 刚刚在群里吹牛逼,由于账号比较多,脑子容易 ...
- 详解 Flexible Box 中的 flex 属性
导读: 弹性盒子是 CSS3 的一种布局模式,一种当页面需要适应不同的屏幕大小以及设备类型时确保元素拥有适当的行为的布局方式.其中 flex 属性用于指定弹性子元素如何分配空间. flex 属性的值 ...
- Centos 文件权限修改
1.查看权限 # ls -l dirPath 2.修改权限,root权限执行(-R 子目录的权限都会改变) # chmod -R dirPath
- 一、hibernate环境搭建
hibernate环境搭建 下载hibernate hibernate的jar 连接数据库的jar 解压hibernate,解压后目录结构 documentation :对应hibernate开发文档 ...
- MySQL数据库企业级应用实践(主从复制)
MySQL数据库企业级应用实践(主从复制) 链接:https://pan.baidu.com/s/1ANGg3Kd_28BzQrA5ya17fQ 提取码:ekpy 复制这段内容后打开百度网盘手机App ...