-1

I was attempting to test a VHDL project with Isim Simulator within ISE. Behavioral simulation works fine while Post-Route produces a lot of errors of this kind:

Warning: /X_FF PULSE WIDTH High VIOLATION ON RST; Expected:= 1.794 ns; Observed:=1.369 ns.

Why this error shows up? How could I solve it? I tried to load the relative bitstream on my Basys2 board but it doesn't work. Could it be due to this simulation error? Thanks

Control Unit code:

    type state is (IDLE, INIT, LSHIFT, ADD, SUB, SETQ);
    signal curr, nxt : state := IDLE;


begin

p0: process(clock, reset_n_in)
begin
    if reset_n_in = '0' then
        curr <= IDLE;
    elsif rising_edge(clock) then
        curr <= nxt;
    end if;
end process;

fsm : process (curr, start,reset_n_in,fine_conteggio,S)
begin
--          if reset_n_in = '0' then 
--              reset_n_out <='0';
--          else
--              reset_n_out <='1';
--          end if;


        done <='0';
        en_write_Q <= '0';
        en_shift <= '0';
        en_M <= '0';
        incrementa_conteggio <= '0';
        en_write_S_A <= '0';
        carica_operando_Q <= '0';
        subtract <= '0';

        case curr is
            when IDLE =>
                if start = '1' then
                    reset_n_out <='0';
                    done <='0';                     
                    nxt <= INIT;
                else
                    nxt <= IDLE;
                end if;
                if fine_conteggio = '1' then
                    done <='1';
                    nxt <= IDLE;
                end if;

            when INIT =>
                en_M <= '1';
                en_write_S_A <= '1';
                en_write_Q <= '1';
                reset_n_out <='1';
                carica_operando_Q <= '1';
                nxt <= LSHIFT;

            when LSHIFT =>
                en_shift <= '1';
                nxt <= SUB;

            when SUB =>

                subtract <= '1';
                en_write_S_A <= '1';
                nxt <= SETQ;

            when ADD =>

                en_write_S_A <= '1';

                if fine_conteggio = '0' then
                    incrementa_conteggio <= '1';
                    nxt <= LSHIFT;
                else
                    nxt <= IDLE;
                end if;


            when SETQ =>
                en_write_Q <= '1';

                if S = '1' then
                    nxt <= ADD;
                else
                    if fine_conteggio = '0' then
                        incrementa_conteggio <='1';
                        nxt <= LSHIFT;
                    else
                        nxt <= IDLE;
                    end if;
                end if;

        end case;
end process;
Mazzola
  • 75
  • 7
  • 1
    We can't help you on this without any code and stimuli.... – Paebbels Feb 25 '16 at 18:13
  • 2
    At least from the error message it self I can tell that you are not obaying the hold time for input RST – Paebbels Feb 25 '16 at 18:14
  • there's a lot of code in my project. I didn't post it because of the length. However if that could help, I can post it with no problems. – Mazzola Feb 25 '16 at 18:24
  • 1
    Regarding the error message, you reset pulse is to short. How do you generate your reset? – Paebbels Feb 25 '16 at 18:27
  • @Paebbels I added the code of my project. It should do the restoring division. However reset signal is in the top entity and in the testbench is always set to zero. – Mazzola Feb 25 '16 at 19:49
  • Your code is for behavioral RTL simulation, but your question is about a timing simulation using IEEE.Vital (X_FF is a Vital model of a flip flop). – Paebbels Feb 25 '16 at 20:00
  • Yes, I switched to Post- Route simulation for debugging purposes because the project does not work on my Basys2 board even if Behavioral simulation is correct. – Mazzola Feb 25 '16 at 20:04
  • Timing reports could be used to trace the cause, either too many 'gate' levels, routing delays depending on placement, clock skew or issue with the clock period (and one of the preceding). Your omitted occurrence time could also point out the cause by looking at transitions and delays affecting the preceding rising edge on RST. Posting the pre-synthesis model without pointing out the FF in question or the reset name doesn't help. What's this reset loop through in control unit? (Suggests placement/routing delays). Didn't use the reset in the testbench??? Clock speed? –  Feb 25 '16 at 20:06
  • Asynchronous reset is managed from the control unit in order to separate operative part from control part. Clock frequency in simulation is 100 Mhz – Mazzola Feb 25 '16 at 20:11
  • I also tried to set and unset reset in testbench but the output error in Isim is the same. – Mazzola Feb 25 '16 at 20:17
  • Addendum: A reset pin (RST) of a basic flip flop (FF) can be triggered by load or enable operations too. It depends on the synthesis algorithm and optimizations what is connected to RST. So even if you don't use a reset in your design, it's possible that XST connected the RST pin. – Paebbels Feb 25 '16 at 20:19
  • Did you specified any timing constraints via an UCF file? If no, then you have to. If yes, does the timing analyzer report any errors? And does your testbench meet the timings given in the UCF file? – Martin Zabel Feb 26 '16 at 06:41
  • I haven't specified any timing constraints. I don't even know how to do it. I guess I should make a working project without them as I never heard my professor teaching about them. – Mazzola Feb 26 '16 at 15:36

2 Answers2

1

Timing simulations are not a routine part of a VHDL-based FPGA design flow, unless:

  1. you are trying to trace a suspected tool bug (unlikely!)
  2. you are verifying a design that involves multiple clocks and clock-domain crossings or asynchronous external signals.
  3. You are unsure of your timing constraint coverage.

Normally, in a design that follows good synchronous design practice, behavioural simulation validates the design, and static timing analysis does a far more thorough job of verification that your design meets its timing constraints than timing simulations can : ASSUMING you have correctly set your timing constraints. Some explanation why this approach works well (given valid timing constraints) here.

However it's worth knowing how to run a timing simulation. Given that the post-route simulation model approximates the actual device timing instead of the delta-cycle model, it may interact differently with the behavioral testbench.

Thus some adjustment of the testbench may be required to allow it to work equally well with behavioural and post-route models.

I don't know a good text describing how to do this, but here's my empirical approach which has helped me catch it's share of problems (and get that questioner close to his problem).

A good sign using this approach is if you can get the behavioural and post-route models to fail the testbench in the same way.

Community
  • 1
  • 1
  • Thanks for your answer Brian. I'm very new to VHDL and timing simulation esulate from my purposes. I tried post-route simulation because I was trying to debug my code as it does not work on basys2 board while behavioral simulation works fine. – Mazzola Feb 26 '16 at 18:46
  • 1
    From your latest comment to the question YOU NEED TIMING CONSTRAINTS - possibly just clock period at this stage - then re-run synthesis and P&R and check that they meet timing. If so, then try the design in hardware again. (You may need input and output pin constraints too, depending what it's connected to) –  Feb 26 '16 at 19:06
0

As already emphasized by Brian in a comment below his answer:

You need timing constraints.

Even if your professor haven't talked about yet. Only with timing constraints, the Static Timing Analyzer (STA) can do its work. Also the Place&Route algorithm honors the timing constraints and tries to find a better route between two cells and/or a placement of the logic onto cells, so that, the requested timing (e.g. clock frequency) will be met.

Your Basys2 FPGA board provides a configurable clock oscillator. You can configure it via jumpers to 25 MHz, 50 MHz or 100 MHz, as described in the board manual. The default setting is 50 MHz whereas your testbench simulates a 100 MHz clock.

The Xilinx ISE toolchain uses so called "User Constraint File", UCF for short, for specification of timing constraints. Within the Project Navigator of Xilinx ISE, you can add a UCF File via the menu Project -> New File -> Implementation Constraints File. Specify a file name and press Next. Then the new file will show up in the design hierarchy (in the left). You can edit it by double-clicking. It is just a text file.

To specify a 100 MHz clock, you have to type into the UCF file:

NET "clock" TNM_NET = "clock_group";
TIMESPEC "TS_clock" = PERIOD "clock_group" 10 ns HIGH 50%;

The first line adds all flip-flops connected to the signal clock to a (newly created) timing group clock_group. The second line then constraints this group to a specific clock frequency, here 10 ns for 100 MHz, with a specific duty cycle (here 50%). The active clock-edge is the rising-edge (HIGH). The timing specification has also a name, which must start with TS. The timing report of the STA then refers to this name.

After, you edited the UCF file, you have to run the "Implement Design" step again, so that, new constraints are applied.

To specify a 50 MHz clock with a 40% duty cycle, you would go instead:

NET "clock" TNM_NET = "clock_group";
TIMESPEC "TS_clock" = PERIOD "clock_group" 20 ns HIGH 40%;

The actual value of the duty cycle is only important, if you have both flip-flops triggered at the rising edge and other flip-flops triggered at the falling edge of the same clock. Just select 50% if not specified in a board manual.

More about timing constraints and the syntax of the UCF file, you will find in the Xilinx Constraints Guide.

Martin Zabel
  • 3,589
  • 3
  • 19
  • 34
  • And finally, if your design is written for a 100 MHz clock, then you have set also the jumper to 100 MHz and the UCF file to 100 MHz. – Martin Zabel Feb 27 '16 at 00:23
  • ok... added the timing constraint on the clock but nothing changed in post-route simulation. I still experience the same errors. – Mazzola Feb 28 '16 at 16:35
  • Ok, then you have two options: a) If you just want to get it work on the FPGA board, then double-check if all pin assignments are correct and the clock jumper is set to 100 MHz. b) If the error is still present, then you should follow the advice from Brian on how to write a post-route testbench. I can't help here because I haven't done it before. – Martin Zabel Feb 28 '16 at 17:18
  • Ok guys. After days of debugging, I went to my professor and he suggested me to rewrite the Control Unit fsm(I edited the code so that now only shows the fsm). I think I found the problem and it is in the signal `reset_n_out`. Looks like that if statement commented in the code gives some problems because behavioral and post route simulations do match(with a wrong behavior) without it. However how can I modify the code? I tried to assign `reset_n_out` in the first process (p0) but this leads me to multiple assignment error when assigning it in the other process. Thanks – Mazzola Mar 02 '16 at 16:42
  • I just tried and simulation goves no errors even if I keep the if block commented in the code but I delete the `reset_n_out` assignement in IDLE and INIT states. So I guess that for some reasons they can't stay together?? – Mazzola Mar 02 '16 at 16:58
  • @Mazzola Please, do not make late changes to question. This may render the answers useless. Instead ask a new question. You can refer to this question to provide context. Describe what has changed since this question. And try to reduce your code as much as possible without changing the errornous behaviour. – Martin Zabel Mar 02 '16 at 17:06