Hi,
I am responding to your queries in a Q/A format below, please have a look.
Q1) What is the difference between start_item method in code 1 and the 6 step method in code 2?
A. Basically both the things are valid i.e. invoking a sequence item using a `uvm_do macro(6 steps mentioned) or the start_item()/finish_item() methods.
Code 1 won't call any internal methods and send the sequence item to the driver connected with the sequencer(Note the sequencer was already set when you started your sequence). All in all this will result in less simulation time.
Code 2 the 6 steps is nothing else than what a `uvm_do macro houses. What this will do is, it will call some extra methods as well which eats up extra sim time. The use of `uvm_do it calls pre_do and post_do methods and internally completes all the process from create_item to till item_done().
Usage of any of the above mentioned completely depends upon the user. You can refer below links for further details:
https://www.chipverify.com/blog/tags/uvm-sequence-macros
https://www.chipverify.com/uvm/how-to-execute-sequences-via-start-method
https://www.chipverify.com/uvm/how-to-execute-sequences-via-uvm-do-macros
Q2) One more question I have is that if I am not using rand fields in my sequence item do I need to randomize the fields/ randomize the transactions in uvm_sequence_item(is sequence_item.randomize() mandatory step in body of sequence even if the fields are not rand)?
A. It is not mandatory to use .randomize(). But both the things are legit even if you randomize it or not.
It is better that you randomize it because, may happen that going forward you add some rand fields to your code and if .randomize() is not called it won't randomize that particular field (Sometimes we miss these small things and invest time in debugging at other places)
Thank You