The diffference i understand between usage of semaphore and mailbox is as follows
--Semaphores canot be used for data transfer between two concurrent processes ,however it helps in synchronizing them.As an example if two parallel processes lets say two different drivers are driving a same set of signals ,then to avoid contention it becomes necessary to use semaphores.
Mailboxes can be used to transfer data between two concurrent processes ,lets say our DUT supports 2 different bus protocols for accessing register space.We would have a scenario wherein we write a register from one bus driver and read it from the other bus
monitor,in that case we need to pass address and the expected data from the register or atleast the address incase we have a shadow register implemented in the Testbench
Is this a correct understanding.Please provide with examples as i am sure such features are frequently used in VE dev
Are channels fundamentally mailboxes?
So in a nutshell semaphores are used to avoid bus contention when two drivers drive the same bus or allow a process to read a register ,only when it has been written to.Mailboxes as you mentioned can be used to send data between concurrent process such as generator and driver and can configured for WAIT,NO_WAIT.......and the mailbox size is also configurable.Hence i think the fundamental element of a channel is a mailbox.
Would you explain with an example with coding...Thank you.
UVM has a good example with the application of the get_next_item method. Here is a pointer that discusses the method and shows the application: https://www.chipverify.com/uvm/uvm-using-get-next-item