Rocket

https://mp.weixin.qq.com/s/Gqv09RIgSSg5VKe-wb4aGg

 
讨论tilelink中使用MaskGen生成mask的用法。
 
1. tilelink中的mask
 
1) channel a/b包含一个mask信号:
 
Byte lane select for messages with data:
这里并没有显示mask信号。可以看到传输数据使用的byte lane与地址是对应的。按照mask的定义,如果整理出来,应该如下表:
 
 
a. The mask is also used for messages without a data payload. Get消息的data域是被忽略的,但是mask仍然要按照address/size去生成。
 
b. When the operation size is smaller than the data bus, the mask should be generated identically to an operation which does carry a data payload.
 
c. For operations which are larger than the data bus, all bits of the mask should be HIGH, although the message remains a single-beat.
 
d. PutPartialData比较特殊,mask中的HIGH比特不需要连续:0xa。
但是size=2^3=8字节,但是却只写了3个字节。a_size定义如下:
可以看到:
- a_size表示的是操作对象的范围(range),也就是说要写的数据从这个里面选;
- 这个写是不是一定写,而是有可能写(possibly write);
 
从以上两点可以看出,PutPartialData写的数据是在a_address/a_size范围内的mask任意为一的位对应的字节。
 
2) mask的实现
 
a. Get
 
使用MaskGen实现:
注意两点:
- address需要跟size对齐,也就是address%size=0;
- mask中为1的比特要连续;
 
实现mask的MaskGen()需要满足这两点。
 
b. PutFullData
 
同样包含Get中的两点:
- address需要跟size对齐,也就是address%size=0;
- mask中为1的比特要连续;
 
所以可以使用MaskGen()实现:
 
a_size表示要写的数据的总字节数;
 
c. PutPartialData
 
- address需要跟size对齐,也就是address%size=0;
- mask中为1的比特不需要连续;
 
其实现没有使用MaskGen(),需要外部实现后传入:
这里也可以看出MaskGen的特点。
 
a_size的意义在上面也分析过了:
- a_size表示的是操作对象的范围(range),也就是说要写的数据从这个里面选;
- 这个写是不是一定写,而是有可能写(possibly write);
 
2. MaskGen
 
从上面的分析可以看出,MaskGen()生成的mask的特点如下:
- address需要跟size对齐,也就是address%size=0;
- mask中为1的比特要连续;
 
在之前对MaskGen(链接:https://mp.weixin.qq.com/s/_aJqf1cFJDK5RVRBhxTWOw)的介绍中,与预期不一致的行,都是因为地址和size不对齐:
 
而注释中地址和大小并没有对齐:
 
这个例子似乎有点问题。
 
 
原文地址:https://www.cnblogs.com/wjcdx/p/11144095.html