• Techo

[IC驗證] Memory block randomization constraint

更新日期:2020年9月14日

1. Try to allocate the 4KB SRAM into 5 partitions with each partition having equal size

Ans:

class Allocate_mem;


rand bit[12:0] start_addr[5];

rand int unsigned size;

constraint c_size {

size <= 4096 / 5;

size inside {64, 128, 512 };

}

constraint c_no_overlap {

foreach( start_addr[i] )

if( i < 5 )

( unsigned'(start_addr[i]) + size ) < start_addr [i+1];

else

( unsigned'(start_addr[i]) + size ) < 4096;

}

endclass


2. Try to partition the 4KB SRAM into 5~10 partitions with each partition having equal size

Ans:

class Allocate_mem;


rand bit[12:0] start_addr[];

rand int unsigned number;

rand int unsigned size;

constraint c_num { number >= 5; number <=10; }

constraint c_num_part { start_addr.size() == number; }

constraint c_size {

size <= 4096 / number;

size inside {64, 128, 512 };

}

constraint c_no_overlap {

foreach( start_addr[i] )

if( i != (number-1) )

( unsigned'(start_addr[i]) + size) < start_addr[i+1];

else

( unsigned'(start_addr[i]) +size ) < 4096;

}

endclass


3. Try to partition the 4KB SRAM into 5~10 partitions with each partition having random size

Ans:

class Allocate_mem;

rand bit[12:0] start_addr[];

rand int unsigned number;

rand int unsigned size[];

constraint c_num {

number >= 5; number <=10;

}

constraint c_num_part {

start_addr.size() == number;

size.size() == number;

}

constraint c_sum {

size.sum() <= 4096;

}

constraint c_blk_size {

foreach(size[i]) {

size[i] inside {64, 128, 512 };

}

}

constraint c_no_overlap {

foreach( start_addr[i] )

if( i != (number-1) )

unsigned'(start_addr[i]) + size[i] < start_addr[i+1];

else

unsigned'(start_addr[i]) + size[i] < 4096;

}


endclass


57 次瀏覽0 則留言

最新文章

查看全部

[科技產業] IC設計股價起飛中,我該換工作嗎?

一兩個月前接到高通 Qualcomm 的電話 說是要發offer給我 由於距離面試結束後已經過了四五個月 時機已不同所以一些因素我婉拒了這個 offer 但後來不斷有 recruiter 或是 headhunter 一直寄信給我 例如 Arm china, Nvidia, Google, SiFive 在這個時機點都瘋狂地找人 讓我不禁懷疑真正的IC設計時代難道現在才開始嗎? 我留下這篇文章來記錄

[IC design] Advanced IC design interview question - 2

There is a RTL code generator tool for generating custom defined instructions, we can define instructions for specific function for user's requirement. Each instruction has it's own input operands and

Logo2020.JPG
  • Instagram - White Circle
  • Google+ - White Circle
  • Facebook - White Circle

Contact Us

Techo私人程式家教

官方LINE ID : @tutortecho

zh-Hant.png

© Copyright 2018 by Sherry Wu and Techo Chao.

Proudly created with Wix.com,

but page loading is too slow,so I don't recommend it.