Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

SignalTap II issue

Hello,

Here is debounce state machine:

module debounce_explicit(input clk, reset, sw, output reg db_level, db_tick);    //symbolic state declaration
    localparam 
        zero =    2'b00,
        wait0 =    2'b10,
        one =     2'b11,
        wait1 =    2'b01;
        
    // number of counter bits (2'N * 20ns = 40ms)
    localparam N = 21;
    //localparam N = 15;
    
    // signal declaration
    reg  state_reg, state_next;
    reg  q_reg;
    wire  q_next;
    wire q_zero;
    reg q_load, q_dec;
    
    // FSMD state & data registers
    always @(posedge clk, posedge reset)
        if (reset)
            begin
                state_reg <= zero;
                q_reg <= 0;
            end
        else
            begin
                state_reg <= state_next;
                q_reg <= q_next;
            end
            
    // FSMD data path (counter) next—state logic
    assign q_next = (q_load) ? {N{1'b1}} : ((q_dec) ? q_reg - 1 : q_reg);
    // status signal
    assign q_zero = (q_next == 0);
    
    // FSMD control path next—state logic
    always @*
        begin
            state_next = state_reg;    // default state: the same
            q_load =     1'b0;         // default output: 0
            q_dec =        1'b0;         // default output: 0
            db_tick =     1'b0;         // default output: 0
            case (state_reg)
                zero:
                    begin
                        db_level = 1'b0;
                        if (sw)
                            begin
                                state_next = wait1;
                                q_load = 1'b1;
                            end
                    end
                    
                wait1:
                    begin
                        db_level = 1'b0;
                        if (sw)
                            begin
                                q_dec = 1'b1;
                                if (q_zero)
                                    begin
                                        state_next = one;
                                        db_tick = 1'b1;
                                    end
                            end
                        else    // sw==0
                            state_next = zero;
                    end
                    
                one:
                    begin
                        db_level = 1'b1;
                        if (~sw)
                            begin
                                state_next = wait0;
                                q_load = 1'b1;
                            end
                    end
                    
                wait0:
                    begin
                        db_level = 1'b1;
                        if (~sw)
                            begin
                                q_dec = 1'b1;
                                if (q_zero)    state_next = zero;
                            end
                        else    // sw==l
                            state_next = one;
                    end
                    
                default: state_next = zero;
            endcase
        end
endmodule

And here is SignalTap simulation

http://www.alteraforum.com/forum/attachment.php?attachmentid=13218&stc=1

After 2st firing of the input sw the "state machine" frozes definitely in "00" state.

Moreover, after 1st sw firing, the "state machine" value is displayed in symbolic interpretation in SignalTap II, i.e. zero, wait0, one, wait1.

After 2nd sw firing this symbolic interpretation disappears ... leaving place to numeric interpretation, i.e. 0 (as shown on the above image).

So I have 2 questions:

  • why symbolic interpretation disappears

  • is it possible to put into SignalTap the signals that present in the source code in order to debug "system machine" misbehavior. Actually only few signals are available for SignalTap.

Thanks in advance

13 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Run "Report Ignored Constraints" command in TimeQuest to see if all your SDC commands are accepted.

    After running "Report Unconstrained Paths" check which actual ports are unconstrained (In Report window see Unconstrained Paths -> Setup Analysis -> Unconstrained Input Ports or Unconstrained Output Ports). This way you will find out which ports are left unconstrained or there is some error in your SDC file.

    I am guesing that you will find that those two input ports are altera_reserved_tdi and altera_reserved_tms. You can also use set_false_path for those ports. For JTAG i use:

    create_clock -period "10 MHz" -name altera_reserved_tck [get_ports altera_reserved_tck]

    set_false_path -from [get_ports {altera_reserved_tdi}]

    set_false_path -from [get_ports {altera_reserved_tms}]

    set_false_path -to [get_ports {altera_reserved_tdo}]

    # Specify the JTAG clock in a group

    set_clock_groups -asynchronous -group altera_reserved_tck

    --- Quote End ---

    Yes, it's the case, the unconstraiuned inputs are altera_reserved_tdi and altera_reserved_tms.

    Concerning constraints for JTAG signals is it necessary to create altera reserved_clk, as it's already present ?

    https://www.alteraforum.com/forum/attachment.php?attachmentid=13258

    Thanks
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Finally, Synchronization Register Chains resolved the problem.

    I applied 2 flip-flops to sw input:

    	reg sw1, sw2;
    	
    	DFF sync1 (.d(sw), .clk(clk), .clrn(1'b1), .prn(1'b1), .q(sw1));
    	DFF sync2 (.d(sw1), .clk(clk), .clrn(1'b1), .prn(1'b1), .q(sw2));	

    and then applied sw2 to state machine (instead of sw).

    However the signals sw1 and sw2 aren't accessible in signaltap ... only sync1, sync2.

    I suppose that sync1 and sync2 are actually sw1 and sw2 ?

    https://www.alteraforum.com/forum/attachment.php?attachmentid=13260