当前位置:网站首页>[Tear AHB-APB Bridge by hand]~ Why aren't the lower two bits of the AHB address bus used to represent the address?
[Tear AHB-APB Bridge by hand]~ Why aren't the lower two bits of the AHB address bus used to represent the address?
2022-08-01 07:28:00 【IC my uncle】
本章目录:
0. 前言
If you still want to continue to read my articles and collections of written tests and interviews,Please pay attention to me 微信公众号,名字叫“IC二舅”,There will be a lot of information and various collections can be seen,谢谢大家!!!
接下来回到正题===>
Update this blog because I encountered a problem in the process of doing the project,The following is a brief description:
constraint haddr_constr{
(hsize == HWORD) -> (haddr[0] == 1'b0);
(hsize == WORD) -> (haddr[1:0] == 2'b0);
solve hsize before haddr;
}
At first it wasn't very clear why the restriction was in place,I understand after studying,以下是我的个人理解,希望大家批评指正!!!
1. The role of the lower two digits
AHBThe signal conveyed by the lower two bits of the bus is not used to represent the address of the data,The data address is represented by the remainder after removing the lower two bits30位.如下图所示,HSIZEDetermines the type of transfer,是WORD、BYTE还是HALFWORD;在地址阶段,HADDRand the lower two digits of HSIZEThe signals together determine the transmission,Where are they stored on the data bus.
You can observe the picture to find out,HSIZE=00时,means that the transmission isBYTE,8位的,那么,HADDRIt's up to you to decide which octet you are storing;同理,HIZE=01,那你HADDRThe lower bit will not work,就是0;同理,HSIZE=10时,传输一个WORD,32位,那你的HADDRBoth are0,That's whyADDRThe lower two bits are restricted.
2. 为什么ADDRThe lower two bits are used to store other information,rather than address information?
The main reason is that the data bus is 32bit,The process of data interaction is based on32bit(4个字节)来进行的,If you only need to read and write one or half a word,can be obtained by the above method.
因此,CORTEX-M核中,The offset of the address always starts with “4”Offset in units,Therefore, the lower two bits have not been used,So it is used to store other information.如下图所示,地址每次偏移4字节,The lower two digits are useless.
不论怎么样,The lower two bits are never used to update the address,Because every time4为单位递增,That is, it starts to increase from the third digit.
2. 关于solve…before…的说明
之前在学习SV的时候,Never seen such a constraint,今天学习一下
(The previous constraints can refer to another blog:传送门)
SystemVerilog中随机变量在常见的约束(符号约束、inside约束、条件约束、内嵌约束)条件下,其随机值出现的概率是均等的.但是 使用solve…before约束后,将会改变随机数值的出现几率,使得某些特定的取值情况更易出现.
2.1 没有solve…before…
class transaction;
rand bit a;
rand bit[1:0] data;
constraint c1{
a -> data==3'h3;} //条件约束
endclass
module gen_data;
initial begin
transaction tr=new() ;
for(int i=0; i<10; i++ ) begin
tr.randomize() ;
$display("a= %0d, data= %0d",tr.a, tr.data) ;
end
end
endmodule
The above one just adds a conditional constraint,结果如下:
打印结果如下:
a= 0, data= 2;
a= 0, data= 2;
a= 0, data= 3;
a= 0, data= 1;
a= 0, data= 0;
a= 0, data= 2;
a= 1, data= 3;
a= 0, data= 3;
a= 0, data= 1;
a= 0, data= 1;
due to the existence of conditional constraints,当a=1,data只能为3;而a=0,data可取0,1,2,3四种组合,所以共有5种组合,Each combination has the same probability of occurrence,即1/5,如下表:
2.2 加上solve…before…
class transaction;
rand bit a;
rand bit[1:0] data;
constraint c1{
a -> data==3'h3; //条件约束
solve a before data;} //在给出dataRandom values are given firsta的随机值
endclass
module gen_data;
initial begin
transaction tr=new() ;
for(int i=0; i<10; i++ ) begin
tr.randomize() ;
$display("a= %0d, data= %0d",tr.a, tr.data) ;
end
end
endmodule
Except for one conditional constraint,还增加了solve…before…,The probability of a random outcome will change.
打印结果如下:
a= 1, data= 3;
a= 0, data= 2;
a= 0, data= 3;
a= 0, data= 1;
a= 1, data= 3;
a= 0, data= 2;
a= 1, data= 3;
a= 0, data= 3;
a= 0, data= 1;
a= 0, data= 1;
由于 solve a before datathe existence of constraints,随机变量awill be assigned a random value first,a为1或0的概率为1/2,接下来再为dataRandom variables are assigned random values,Its probability depends on a的值,如下表:
注意:randcType variables are not allowedsolve…before约束;
参考文献
声明
本人所有系列的文章,仅供学习,不可商用,如有侵权,请告知,立删!!!
本人主要是记录学习过程,以供自己回头复习,再就是提供给后人参考,不喜勿喷!!!
如果觉得对你有用的话,记得收藏+评论!!!
边栏推荐
猜你喜欢

升级为重量级锁,锁重入会导致锁释放?

Three aspects of Ali: How to solve the problem of MQ message loss, duplication and backlog?

Datagrip error "The specified database userpassword combination is rejected..."Solutions

爬虫基本原理介绍、实现以及问题解决

Golang:go模版引擎的使用

How to use Photoshop to composite star trail photos, post-processing method of night sky star trail photos

Srping bean in the life cycle

NIO编程

国内外最顶级的8大plm项目管理系统

LabVIEW RT中的用户界面更新速度
随机推荐
rhcsa 第四天
Golang:go模版引擎的使用
小程序更多的手势事件(左右滑动、放大缩小、双击、长按)
配置我的kitty
表的创建、修改与删除
上课作业(7)——#598. 取余运算(mod)
pytest interface automation testing framework | single/multiple parameters
Json对象和Json字符串的区别
拳头游戏免版权音乐下载,英雄联盟无版权音乐,可用于视频创作、直播
Upgrade to heavyweight lock, lock reentrancy will lead to lock release?
Generate pictures based on the content of the specified area and share them with a summary
I have three degrees, and I have five faces. I was "confessed" by the interviewer, and I got an offer of 33*15.
The log causes these pits in the thread block, you have to prevent
C语言学习概览(三)
POJ1287联网题解
"By sharing" northwestern university life service | | bytes a second interview on three sides by HR
第02章 MySQL的数据目录【1.MySQL架构篇】【MySQL高级】
sum of special numbers
微信小程序请求封装
牛客刷SQL---2