


回复 1# 的帖子
Putting test pattern aside. I'm talking about your rtl. Your code is very much wrong...
task shift_in; // task is defining an operation, you don't need to specify the output
output [7:0] shift; // you need to define input but not output here
...
...
...
if your task has sequential logic, it's unsynthesizable.
always @(posedge clk)
if(!rstn)
data_out=8'd0;
else
shift_in(data_out); // you may write in this way data_out = shift_in( input1, input2,....), make sure your task is pure combinational logic
Here you're describing a dff, make sure the output name is the same. If you want to pass a value to the dff propagating through some complex combination logic, better to use an FUNCTION but not TASK. If you want to pass a value to the dff which is from sequential logic, better to define another module, but not use FUNCTION or TASK.
Actually, TASK is very rare to be used in RTL, usually in Test bench.