当前位置:网站首页>[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约束;
参考文献
声明
本人所有系列的文章,仅供学习,不可商用,如有侵权,请告知,立删!!!
本人主要是记录学习过程,以供自己回头复习,再就是提供给后人参考,不喜勿喷!!!
如果觉得对你有用的话,记得收藏+评论!!!
边栏推荐
- 特别数的和
- 我说过无数遍了:从来没有一种技术是为灵活组合这个目标而设计的
- 选择排序—直接选择排序和堆排序
- MVVM project development (commodity management system 1)
- return; represents meaning
- Classwork (7) - #598. remainder operation (mod)
- 根据指定区域内容生成图片并进行分享总结
- 爆肝3万字,最硬核丨Mysql 知识体系、命令全集 【建议收藏 】
- MATLAB program design and application of MATLAB 2.5
- zip打包目录所有文件(含隐藏文件/夹)
猜你喜欢

【HDLBits 刷题】Circuits(1)Combinational Logic

Data organization -- singly linked list of the linear table

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

I have three degrees, and I have five faces. I was "confessed" by the interviewer, and I got an offer of 33*15.

最小生成树

华为深度学习课程第九章——卷积神经网络以及案例实践

【手撕AHB-APB Bridge】~ AHB地址总线的低两位为什么不用来表示地址呢?

【MySQL】操作表DML相关语句

Golang: go open web service

Case practice --- Resnet classic convolutional neural network (Mindspore)
随机推荐
JSON 与 JS 对象的区别
日志导致线程Block的这些坑,你不得不防
好的plm软件有哪些?plm软件排行榜
VoLTE Basic Learning Series | Enterprise Voice Network Brief
Summary of test points about app updates in different ways
Self-made a remote control software - VeryControl
JVM: Runtime Data Area - PC Register (Program Counter)
Json对象和Json字符串的区别
我三本学历,五面阿里,被面试官“供”着出来了,拿了33*15的Offer
VSCode 快捷键及通用插件推荐
The Bean's life cycle
Data Analysis 5
Electromagnetic compatibility introductory tutorial (6) test project
R语言使用gt包和gtExtras包优雅地、漂亮地显示表格数据:gtExtras包的pad_fn函数与gt::fmt函数一起用于填充包含数值的特定列、对数据列的数值进行十进制对齐(从小数点对齐)
Case practice --- Resnet classic convolutional neural network (Mindspore)
Three aspects of Ali: How to solve the problem of MQ message loss, duplication and backlog?
mysql查看cpu使用情况
华为深度学习课程第九章——卷积神经网络以及案例实践
MATLAB程序设计与应用 2.5 MATLAB运算
Classwork (7) - #598. remainder operation (mod)