有什么区别:
1
BigIntegerList problem;
LinkedList x;
BigIntegerNode curr;
problem = new BigIntegerList();
//get value of first line stating #of bigInts to read in
problem.n = LinkedList.readInteger(in);
//read big ints from text file based on first number passed, n
for(int i=0; i<problem.n;i++)
{
x = new LinkedList();
x.readBigInteger(in);
//case that the list is empty
if(problem.n<1)
{
problem.start = new BigIntegerNode(x,null);
problem.rear = problem.start;
//list is not empty, add nodes to rear
}else
{
curr = new BigIntegerNode(x,null);
problem.rear.next = curr; -----> this is where i get a nullpointer....
problem.rear = curr;
}
}
return problem;
2
forever begin
**@posedge(clk) begin**
if(vif.sof == 1) begin
//some code here
end
end
end
与@(posedge clk)相关的begin..end会有所作为吗?
答案 0 :(得分:1)
@
和#
等event_controls本身并不是声明;它们是后面的陈述的前缀。 语句可以是一个简单的语句,如赋值,或者像begin / end或fork / join这样的块。只要允许单个语句,就允许使用块。
当你写@(posedge clk);
时,它真的是@(posedge clk) null_statement;
我应该给你足够的信息来回答你的问题,但这是另一种变化:
forever
@posedge(clk)
if(vif.sof == 1) begin
//some code here
end
现在,如果分号跟@(posedge clk)
之后有分歧,则会有很大差异。