Implement transaction logic in driver or sequence class

How to generate a transaction- In 25 clks I need to send 15 transaction. These transactions can be send randomly anytime within 25 clks. Should I implement logic in driver class or sequence class and how?

In reply to ak_verifsj:

If your interface is such that every transaction is one clock cycle, I would invent a dummy transaction and have your sequence send 25 transactions of which exactly 10 of them are randomly selected to be dummy transactions. You could even create a hiearchy of sequences to do this, but without knowing all the possible situations you need to cover, it’s hard to know what would be best for your situation.

In reply to dave_59:

Hi dave, I think my wordings made the question little complicated. Rephrasing the questions - Consider scenario where I need to send data[31:0] on each clk. I need to send 15 data in 25 clks. On the remaining 10 clks driver should not drive anything on DUT.

In reply to ak_verifsj:

On the remaining 10 clks driver should not drive anything

Do you mean the bus should be floating Hi-Z?

In reply to ak_verifsj:

In reply to dave_59:
Hi dave, I think my wordings made the question little complicated. Rephrasing the questions - Consider scenario where I need to send data[31:0] on each clk. I need to send 15 data in 25 clks. On the remaining 10 clks driver should not drive anything on DUT.

Your interface spec should say what are you doing when not sending data to the DUT. Maybe your interafce has an ‘idel’ state.
BTW the sequencer does not send any transaction to the driver. The driver polls the transactions from the sequencer. In the driver there is all timing and nowhere else.

In reply to warnerrs:

In reply to ak_verifsj:
Do you mean the bus should be floating Hi-Z?

It should not be floating but should be 'b0.

In reply to chr_sue:

In reply to ak_verifsj:
Your interface spec should say what are you doing when not sending data to the DUT. Maybe your interafce has an ‘idel’ state.
BTW the sequencer does not send any transaction to the driver. The driver polls the transactions from the sequencer. In the driver there is all timing and nowhere else.

Right now the only concern is where should I implement this particular logic of sending 15 valid data randomly anytime in 25 clks and drive 'b0 in remaining 10 clks. I want to know where should I implement the logic either in (driver/sequence) and how?

In reply to ak_verifsj:

Your question is difficult to answer because you haven’t provided any information about what it means to “drive” data versus “not drive” data. From your last response it seems like non-zero data is “driving”. If that’s the case, your driver does not need to know anything about what data its driving and can all be implemented by the sequence.

It’s still not clear if you need to send 15 non-zero random values followed by 10 zero values, or if you need to send 25 random values of which exactly 10 of them are 0.

In reply to dave_59:

In reply to ak_verifsj:
Your question is difficult to answer because you haven’t provided any information about what it means to “drive” data versus “not drive” data. From your last response it seems like non-zero data is “driving”. If that’s the case, your driver does not need to know anything about what data its driving and can all be implemented by the sequence.
It’s still not clear if you need to send 15 non-zero random values followed by 10 zero values, or if you need to send 25 random values of which exactly 10 of them are 0.

Hi dave, thats right; I need to send 25 random value with exactly 10 zero values. I simplified that values to be single data but in reality they are transaction with(addr, data,…etc)

In reply to ak_verifsj:

Look at the last example of my DVCon paper: SystemVerilog Constraints: Appreciating What You Forgot in School to Get Better Results. You can change the constraint for HEADS to a 0 data value, or whatever represents a non-driving transaction.

In reply to dave_59:

In reply to ak_verifsj:
Look at the last example of my DVCon paper: SystemVerilog Constraints: Appreciating What You Forgot in School to Get Better Results. You can change the constraint for HEADS to a 0 data value, or whatever represents a non-driving transaction.

Thanks that was a good suggestions. I did not think of weighted dist application here. I tried to code it but one count mismatch, I randomize 25 times and see valid==1 14 times only

bit valid;
constraint c1{valid dist {1:= 15, 0:=10};}

Is this the correct way to use dist function to get valid==1 15 times for every valid==0 10times?

In reply to ak_verifsj:
This is explained in the last example of the the paper.

rand bit valid;
randc int scale;
constraint c {
        scale inside {[0:24]};
        if (scale < 15) -> valid == 1; else valid == 0;  }

In reply to dave_59:

Thanks a lot!