Significance of 'this' keyword in start method - system-verilog

I'm confused with use of keyword 'this'.
Case1:
sequence.start(get_sequencer, this);
Case2:
sequence.start(get_sequencer);
Both the cases are compiling without error. But case2 is giving is giving a violation in rules check stage.I want to know what difference does 'this' cause.
How 'this' is different from using it inside a function and while passing it as an argument.

The start() method of a sequence has as its first two arguments:
sequencer - a handle to the sequencer that sequence will start running on
parent_sequence - an optional handle to the parent sequence that started this sequence
The Parent/child relationships of sequences are used in the locking/unlocking mechanisms among other things. The second argument it optional, so there must be some other tool that is generating a warning message that you need to explain.

Related

swift syntax, func(var:var:) as a closure?

I am using firebase authentication and adding a listener for authentication state changes as:
var handle = auth?.addStateDidChangeListener(self.updateUI(auth:user:))
while updateUI is a function I have created with signature: (Auth, User?) -> void
I don't understand the syntax of "(auth:user:)" and was thinking perhaps I need a "," in between auth and user, but that gives me compiler error. I'd appreciate if someone can explain this to me
By writing updateUI(auth:user:), what you are referring to is the method itself, and you are not calling the method immediately. This is an explicit-member-expression as the language reference calls it. And the language reference says that one of the forms that an explicit-member-expression can take is:
As you can see from the formal grammar, inside the parentheses, there can be zero or more argument-name, and an argument-name is an identifier followed by the character :.
So why don't you need ,?
Because the language reference says so. :)
If you think about it, the : is already delimiting the different parameter labels, so you don't need an extra delimiter.
Why write out the parameter labels in the first place?
It is likely to avoid ambiguity. There's probably another overload of updateUI with different parameter labels, so just saying updateUI could be ambiguous. If there is only one updateUI, then you can just say updateUI.

I am getting an error while trying to pass the data from scoreboard to sequence, how to get rid of it?

I am new to UVM and I am trying to verify a memory design where I am trying to run a write sequence multiple times followed by read sequence same number of times so that I could read the same addresses I am writing to, and compare. For this I tried to create a new class extended from uvm_object with a queue to store the addresses I am writing to, so that I could use them in read seq and I am instantiating this class in the scoreboard and then sending the handle of class to the read sequence via uvm_config_db, now the issue is I am able to store addresses in queue but unable to get the class handle in read sequence ......Is this the right way of checking or is there some better way to check the write and read back from memory, please help me !
entire code link (yet to complete): https://www.edaplayground.com/x/3iTr
Relevant code snippets:
This is the class I created to store the addresses
class address_list extends uvm_object;
reg[7:0]addr_q[$];
function new(string name);
super.new(name);
endfunction
endclass;
In my scoreboard, I am passing the handle of class with address queue to the read sequence, here is the snippet from scoreboard
virtual function void write(mem_seq_item pkt);
if(pkt.wr_en==1)
begin
pkt_qu_write.push_back(pkt);
addr.addr_q.push_back(pkt.addr);
uvm_config_db#(address_list)::set(uvm_root::get(),"*","address",addr);
end
if(pkt.rd_en==1)
pkt_qu_read.push_back(pkt);
`uvm_info(get_type_name(),$sformatf("Adder list is
%p",addr.addr_q),UVM_LOW)
endfunction : write
In my read sequence, I am trying to get the handle
virtual task body();
repeat(3)
`uvm_do(wr_seq)
if(!uvm_config_db#(address_list)::get(this, " ", "address", addr_))
`uvm_fatal("NO_VIF",{"virtual interface must be set for:",get_full_name(),".addr_"});
`uvm_info(get_type_name(),$sformatf("ADDR IS %p",addr_),UVM_LOW)
repeat(3)
`uvm_do(rd_seq)
endtask
Error-[ICTTFC] Incompatible complex type usage
mem_sequence.sv, 137 {line where i try to get from uvm_config_db}
Incompatible complex type usage in task or function call.
The following expression is incompatible with the formal parameter of the
function. The type of the actual is 'class $unit::wr_rd_sequence', while
the
type of the formal is 'class uvm_pkg::uvm_component'. Expression: this
Source info: uvm_config_db#
(_vcs_unit__3308544630::address_list)::get(this,
" ", "address", this.addr_)
There are two problems with this line:
if(!uvm_config_db#(address_list)::get(this, " ", "address", addr_))
One is causing your error. One might lead to you not being able to find what you're looking for in the database.
This (literally this) is causing your error. You are calling get from a class derived from uvm_sequence. The first argument to get is expecting a class derived from uvm_component. Your problem is that a sequence is not part of the testbench hierarchy, so you cannot use a sequence as the first argument to a call to get (or set) in a uvm_config_db. Instead the convention is to use the sequencer that the sequence is running on, which is returned by a call to the sequence's get_sequencer() method. This solves your problem:
if(!uvm_config_db#(address_list)::get(get_sequencer(), "", "address", addr_))
This works because you used a wildcard when you called set.
Notice that I also removed the space from between the quotes. That might not give you a problem, because you used the wildcard when you called set, but in general this string should either be empty or should be a real hierarchical path. (The hierarchy input to the set and get calls is split between the first argument - a SystemVerilog hierarchical path - and the second - a string representing a hierarchical path).
uvm_config_db is basically for passing configuration between components.
For purpose of passing data from scoreboard to sequence, you can use uvm_event.
Trigger event in scoreboard using event.trigger(address_list)
sequence wait for event using event.wait_for_trigger_data(address_list)

Eiffel: are the convert methods working in case of agent call arguments?

I'm calling a procedure with an argument which is an integer_64. I implemented a WATT class which can create it from an INTEGER_64 and it seems the execution stops when reached this point, where am I wrong?
Catcall detected for argument#1args': expected TUPLE [!WATT] but got TUPLE [INTEGER_64]`
Attached case (Update)
Actually when checking with syntax
attached {INTEGER_64} my_watt_object as l_int
it doesn't pass either... is it the expected behaviour?
Actually it seems for me that the semantic cases are the same which have to validate the conformity step... for me (but seems not to be the case for the definition of the language between conformance/conformity) which says
Conformance and convertibility are exclusive of each other,
p.87
Is the conformance rule valid for a type which defines as convert a type to another which is my case from WATT to INTEGER_64?
In Eiffel, the conversion specified by the language works only at compile time. It applies if the source of a reattachment does not conform to the target of the reattachment at compile time and there is the corresponding conversion feature.
No automatic conversion is performed at run-time. If you need this functionality, you need to implement it yourself. In your example, if the argument type is WATT, you need to call the conversion from INTEGER_64 to WATT explicitly, and pass the object of type WATT, not INTEGER_64.

Is there a way to get warnings/errors when a return value of a specific type is unused?

Does Scala have some equivalent to Rust's #[must_use] annotation?
I have a type which always needs to have a method called on it after it is returned. There are several methods that return it, and ignoring the return value is always an error. (It makes calling the method that returned it entirely pointless.)
I can't use -Ywarn-value-discard because the codebase is full of other ignored returns which are fine. I only want a warning/error when certain types are discarded.
In 2.11: -Ywarn-unused Warn when local and private vals, vars, defs, and types are unused.
But that's not what exactly helps in your case.
scala does not warn about unused computation or value
--
For me, it's looks like design issue. Suppose you have init and execute methods.
execute can be invoked only after init... You should force user to invoke this init method before execute.
It can be lazily invoked in the execute or during class construction.
I do not really think about scenarios where you really need such warnings.

GtkAda simple chat error

I'm writing simple chat program in Ada, and I'm having problem with chat window simulation - on button clicked it reads text form entry and puts it on text_view. Here is the code I've written and here is the compile output:
gnatmake client `gtkada-config`
gcc -c -I/usr/include/gtkada client_pkg.adb
client_pkg.adb:14:19: no candidate interpretations match the actuals:
client_pkg.adb:14:37: expected private type "Gtk_Text_Iter" defined at gtk-text_iter.ads:48
client_pkg.adb:14:37: found type "Gtk_Text_View" defined at gtk-text_view.ads:58
client_pkg.adb:14:37: ==> in call to "Get_Buffer" at gtk-text_buffer.ads:568
client_pkg.adb:14:37: ==> in call to "Get_Buffer" at gtk-text_buffer.ads:407
client_pkg.adb:15:34: no candidate interpretations match the actuals:
client_pkg.adb:15:34: missing argument for parameter "Start" in call to "Get_Text" declared at gtk-text_buffer.ads:283
client_pkg.adb:15:34: missing argument for parameter "Start" in call to "Get_Text" declared at gtk-text_buffer.ads:270
gnatmake: "client_pkg.adb" compilation error
Can anyone tell me what is the problem, since I have no idea why procedure Get_Buffer expects Gtk_Text_Iter, and why Get_Text miss Start parameter?
You have to call the correct procedures/functions.
In your example, you call Gtk.Text_Buffer.Get_Buffer, not the correct Gtk.Text_View.Get_Buffer. This is because you with and use Gtk.Text_Buffer, but don't use Gtk.Text_View. You should be careful what you use. Same for Get_Text.
If you add use clauses for Gtk.Text_View and Gtk.GEntry, those errors should disappear.
But I give you an advice: try to use as few as possible use clauses. That way you always know what function is really called.
TLDR: Add use Gtk.Text_View; use Gtk.GEntry; to the declaration part of the On_Btn_Send_Clicked procedure.