FPGA Center



ASSERT

It is an expression that checks the accuracy of a conditional statement and then returns an error message if it is false.

Assert condition
report report
severity importance level;

NOTE : Assertion statement is ignored in synthesizing.

EXAMPLE 1:

assert not (K= '1' and S= '1')
report "Both the values are equal to 1"
severity ERROR;
 When both the K and S signals are equal to "1" an error may ocur and the simulation stops.

EXAMPLE 2:


LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY AND_GATE_TEST_BENCH IS
END AND_GATE_TEST_BENCH;
ARCHITECTURE behavior OF AND_GATE_TEST_BENCH IS

COMPONENT AND_GATE
PORT(
           data0 : IN  std_logic;
           data1 : IN  std_logic;
          output : OUT  std_logic
            );
END COMPONENT;
    signal data0 : std_logic := '0';
    signal data1 : std_logic := '0';
    signal output : std_logic;

BEGIN
     U1: AND_GATE PORT MAP (
                                                    data0 => data0,
                                                    data1 => data1,
                                                    output => output
                                                     );

   process
       begin                
          wait for 10 ms;   
          data0<='1';
          wait for 10 ms;
          data0<='0';
          data1<='1';
          wait for 10 ms;
          data0<='1';
          wait for 10 ms;
          assert false
          report "sim├╝lasyon bitti"
         severity failure;
   end process;
   END;
 The assert expression maket he simulation stop here.

DETAILED EXPLANATION:


Assertion Statement contains three optional pieces of code. Usually all three of these codes are used.
Assert code contains a condition (true,false). If the result of the condition is false, an assertion violation occurs.

Report code contains a message (string). If an assertion violation occurs, this message is reported in simulation.
Severity code contains the level of the assertion violation. If there is no any code written, the severity level is considered to be ERROR. Severity levels which are listed below, are included in the Standard Package.

                                                                                                           

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

Home | Fpga | VHDL | VHDL Dictionary | Digital Design | Simulation | PCB | Examples | Contact Us
Copyright © 2010 - 2013 FPGAcenter. All Rights Reserved.