Hi,
I was assigned a task to convert the always block inside the module to task in a separate file,
Coding :
always @(posedge s_axi_aclk)
begin
if (axi_access_sm == WRITE) begin
if (!axi_status[4]) begin
s_axi_bready <= 1'b1;
if (s_axi_bvalid == 1'b1 && s_axi_bready) begin
axi_status[4] <= 1;
s_axi_bready <= 0;
end
end
end
else begin
s_axi_bready <= 0;
axi_status[4] <= 0;
end
end
I have converted the above always block to task as
task write_resp();
forever @(posedge s_axi_aclk) begin
if (axi_access_sm == WRITE) begin
if (!axi_status[4]) begin
s_axi_bready <= 1'b1;
if (s_axi_bvalid == 1'b1 && s_axi_bready) begin
axi_status[4] <= 1;
s_axi_bready <= 0;
end
end
end
else begin
s_axi_bready <= 0;
axi_status[4] <= 0;
end
end
endtask
I am having a connecting issue itseems, Kindly help me how to call this task inside the module
I am having a connecting issue itseems, Kindly help me how to call this task inside the module
You can call the task from within an initial block.
If the task is called this way from inside the module then I do not see or understand the connectivity issue.
Why would you want to do a always block from within a task?
Converting a testbench to class based is a much bigger topic than your original question.
You can’t call a task in a class before it has been constructed.
The point of having a class based testbench is taking advantage of Object Oriented Programming which allowed you to utilize base class libraries and extend the classes you write for re-usability.
The UVM provides a framework for dealing with constructing a trestbench designed for re-usablility. Without knowing what kind of class-based methodology you are using and the "connectivity problems you are facing, it is difficult to help you.