Line vs fsm coverage

why do we need to collect FSM coverage data from RTL code coverage?
Assume that my stimuli only has a scenario for IDLE->PROCESS transition. Will I still get 100% line coverage (below), since the case statement was anyways evaluated?

always_ff @(posedge clk) begin
    case (state)
        IDLE: if (cache_hit) state <= PROCESS;
        PROCESS: if (cache_miss) state <= REFILL;
        REFILL: if (refill_done) state <= IDLE;
    endcase
end

Each item of a case statement is an executable line. You have three items. Each item has a branching statement. Line coverage only measures that you executed each all statements. FSM coverage measures that you took all possible transitions. In your particular example, there is no difference between the two, but in more complex FSM, you want to check for all possible transitions. FSM coverage can also tell you about unreachable states and deadlocks.

Dave,
Thanks! Is there a document/whitepaper/manual that explains the usage of FSM (and possibly branch and conditional, too) coverage, with all these use cases you mentioned?

Code coverage is mostly a tool specific topic. Check your tool’s user manual or contact them for support.

1 Like

Hello Dave,

Thank you! I have started going through the tools manual.

On a slightly different note, are you aware of any mechanism in RTL code coverage that can help me to measure the duration of a signal continuously holding a certain value? Often, we need to find out whether a particular fifo full signal toggled but that itself is not enough. It would also be very helpful to know how long the fifo full signal was asserted for. Right now, we only use functional coverage method for that and need to probe that RTL signal

Is there any approach in code coverage that can help with this?

What you are asking for definitely falls into the realm of functional coverage using either a covergroup or a cover directive.