Hi,
Why can_put function is to be defined whenever I use a try_put function?
Hi,
Why can_put function is to be defined whenever I use a try_put function?
In reply to dave_59:
Whenever I use a try_put function without any definition of can_put in my code, Iam getting an error like can_put definition not found. If I add can_put definition without any logic inside it in my code, then the error was removed. How exactly this try_put and can_put are related is my question?
In reply to janudeep3:
If you are talking about using the TLM non_blocking_put port, they are always both defined together. You will need to show some code and the actual error
Here is example of component code where I had try_put Implemnetation
/CONSUMER CLASS
class consumer extends uvm_component;
uvm_nonblocking_put_imp#(instruction,consumer) put_port;
function new(string name, uvm_component p = null);
super.new(name,p);
put_port = new("put_port", this);
endfunction
function try_put(instruction t);
$display("consumer receiving =%s",t.inst.name());
endfunction
//Mandatory Implementation
//function can_put();
//endfunction
endclass : consumer
ERROR: Could not find member ‘can_put’ in class ‘consumer’, at “design.sv”.
In the above code I commented out the function can_put. If I remove comments, It works fine but If I comment it, It gives the above eeror. I just want to know why we need to write the can_put definition, even a blank definition. Whats the relation between this try_put and can_put?
In reply to janudeep3:
https://verificationacademy.com/forums/uvm/difference-between-tryput-and-canput-method-tlm
this may help!