活跃农民
- 积分
- 586
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2012-6-26
- 最后登录
- 1970-1-1
|
continue
array_reduction(sum(), product(), and(),or(),xor())
example:
byte b[] = {1,2,3,4}
int d = b.sum() with (int'(item>=2)) // find total count of numbers bigger or equal to 2, notice you must have an int' casting
int d = b.sum() with (item>=2? item : 0) // sum of numbers bigger or equal to 2
logic bit_arr[1024]
int y = bit_arr.sum() with (int'(item)); // without the casting, total result will be 0/1 ONLY!
suppose you have an associate array of object queue ( m_object[$] m_associate_array[*]), how to pass this type as function argument? use typedef
- class
remember super.new() will always be called implicitly
polymorphism ( same as C++, you'd better know virtual table pointer to explain how run time find the implementation)
difference between static task/ task static
difference between task/function
local/protected attribute, what is the usage
pure virtual class/pure virtual function
when to use class scope resolution operator( static element/static method/typedef/enum....)
parameterized class with example in LRM, typedef will help handling parameterized significantly
- procedure
initial block ( you have have multiple initial block)
always block
final block
how to generate a clock with initial block?
reg clk
real clock_period = *****;
initial begin
clk = 0;
forever begin
#(clock_period/2) clk = ~clk;
end
end
automatic variable / static variable difference?
fork join/join_none/join_any
for (int i = 0; i <=10; i++) begin
fork
automatic int j = i; //note you must declare a automatic copy of j here, otherwise it will be same value (10) when you spawn all some_task()
begin
print something;
some_task(j);
end
join_none
end
another trick with static/automatic variable, following code will print 11ns 20, 20ns 20. Why ? Because task is static, even for the argument. how to fix this? use task automatic print(i)
suppose in a module,
task print(i);
#10ns;
$display("%s ns %d",$time,i);
endtask
initial begin
fork
begin
#1ns;
print(10);
end
begin
#10ns;
print (20);
end
join
end
interstatement assignment/intrastatement assignment difference.
#5 a = b;
a = #5 b;
a = @(posedge clk) b
a = repeat (5) @(posedge clk) b
how to use disable fork/wait fork
fine grained process_control (process::self() functions await/status/kill/suspend/resume)
foreach usage( foreach A[i,,k]) //note you can skill something here
what is the difference between passing an object handle by reference and by value? ( you can modify the object content in both case, but if you pass by reference, you can even reassign the object handle, while in pass by value case, you are playing with the copy of object handle. just remember the normal case of integer argument...) so there is a problem in C++, how do you modify a pointer function argument? use void my_func(int* &m_pointer)
- clocking block, read the chapter carefully, i think most people do not understand it good
synchronize signals to clock for sampling/driving
input/output skew
- interface, read the chapter
why do we need virtual interface?
- semaphores/mailbox/event, know the operations
- assertion ( this is a long long long long chapter in LRM, personally I donot have too much experience in writing assertions, but try some examples)
google system verilog assertion, there is some tutorial in duolos dot com which should be enough for interview
- constraint ( this is REALLY important, almost every onsite will be several questions)
how to write a onehot/onecold constraint? do not use function. one cold is similar to onehot just add a "~"
rand bit [7:0] a;
constraint one_hot_cons{
a & (a-1) ==0;
a !=0;
}
how to write constraint to unique array element, do not use unique in LRM 2012
rand bit[31:0] a[100];
foreach (a[i]) {
foreach (a[j]) {
if (i<j) {
a[i] != a[j];
}
}
}
how to write a constraint for 8 queen? board[8][8]
how to write a constraint to constraint the size of dynamic array
how to write a constraint for increasing array
rand/randc difference
how to implement randc without using randc
solve...before, why do we need this?
dist := :/ difference
inside
- functional coverage (read the LRM and try some real example)
- DPI ( export/import DPI functions, how to compile a shared library? how to solve DPI scope issue? )
|
|