关于cache的知识,大家可以看以下链接:
https://zhuanlan.zhihu.com/p/102293437?utm_source=qq
下面为验证rocket-chip icache和dcache的代码。
在这里我只验证cache起到的作用,不会分析直接映射缓存、多路组相缓存和全相连缓存在rocket-chip上的差异,也不会分析具体的miss/hit情况,也不会分析其分配策略,如果后面有做相关测试,会再补充内容。
测试代码如下:
#include "encoding.h"
#include "L1Dcache.h"
#define U32 *(volatile unsigned int *)
#define DEBUG_SIG 0x70000000
#define DEBUG_VAL 0x70000004
#define DATA_SIZE 100
int input1_data[DATA_SIZE] =
{
41, 833, 564, 187, 749, 350, 132, 949, 584, 805, 621, 6, 931, 890, 392, 694, 961, 110, 116, 296,
426, 314, 659, 774, 319, 678, 875, 376, 474, 938, 539, 569, 203, 280, 759, 606, 511, 657, 195, 81,
267, 229, 337, 944, 902, 241, 913, 826, 933, 985, 195, 960, 566, 350, 649, 657, 181, 111, 859, 65,
288, 349, 141, 905, <

最低0.47元/天 解锁文章
2069

被折叠的 条评论
为什么被折叠?



