Changeset 8221

Show
Ignore:
Timestamp:
08/27/08 15:33:30 (5 years ago)
Author:
mcarrick
Message:

improved test bench error checking

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/mcarrick/VHDL/full_adder/full_adder_tb.vhd

    r8211 r8221  
    33library ieee; 
    44use ieee.std_logic_1164.all; 
     5use ieee.numeric_std.all; 
    56 
    67entity test_fa is 
     
    3031                        ); 
    3132 
     33                enter_inputs : process 
    3234 
    33                 set_inputs : process 
    3435                begin 
     36 
    3537                        A <= '0'; 
    3638                        B <= '0'; 
    3739                        CIN <= '0'; 
    38                          
     40                        wait for 1 ns; 
     41                        if (S /= '0' or COUT /= '0') then 
     42                                report "Bad Calculation! Should be: S = 0, COUT = 0."; 
     43                        end if; 
    3944                        wait for 5 ns; 
     45 
    4046                        A <= '0'; 
    4147                        B <= '0'; 
    4248                        CIN <= '1'; 
     49                        wait for 1 ns; 
     50                        if (S /= '1' or COUT /= '0') then 
     51                                report "S and COUT calculated incorrectly."; 
     52                        end if; 
     53                        wait for 5 ns; 
    4354 
    44                         wait for 5 ns; 
    4555                        A <= '0'; 
    4656                        B <= '1'; 
    4757                        CIN <= '0'; 
     58                        wait for 1 ns; 
     59                        if (S /= '1' or COUT /= '0') then 
     60                                report "S and COUT calculated incorrectly."; 
     61                        end if; 
     62                        wait for 5 ns; 
    4863 
    49                         wait for 5 ns; 
    5064                        A <= '0'; 
    5165                        B <= '1'; 
    5266                        CIN <= '1'; 
     67                        wait for 1 ns; 
     68                        if (S /= '0' or COUT /= '1') then 
     69                                report "S and COUT calculated incorrectly."; 
     70                        end if; 
     71                        wait for 5 ns; 
    5372 
    54                         wait for 5 ns; 
    5573                        A <= '1'; 
    5674                        B <= '0'; 
    5775                        CIN <= '0'; 
     76                        wait for 1 ns; 
     77                        if (S /= '1' or COUT /= '0') then 
     78                                report "S and COUT calculated incorrectly."; 
     79                        end if; 
     80                        wait for 5 ns; 
    5881 
    59                         wait for 5 ns; 
    6082                        A <= '1'; 
    6183                        B <= '0'; 
    6284                        CIN <= '1'; 
     85                        wait for 1 ns; 
     86                        if (S /= '0' or COUT /= '1') then 
     87                                report "S and COUT calculated incorrectly."; 
     88                        end if; 
     89                        wait for 5 ns; 
    6390 
    64                         wait for 5 ns; 
    6591                        A <= '1'; 
    6692                        B <= '1'; 
    6793                        CIN <= '0'; 
     94                        wait for 1 ns; 
     95                        if (S /= '0' or COUT /= '1') then 
     96                                report "S and COUT calculated incorrectly."; 
     97                        end if; 
     98                        wait for 5 ns; 
    6899 
    69                         wait for 5 ns; 
    70100                        A <= '1'; 
    71101                        B <= '1'; 
    72102                        CIN <= '1'; 
     103                        wait for 1 ns; 
     104                        if (S /= '1' or COUT /= '1') then 
     105                                report "S and COUT calculated incorrectly."; 
     106                        end if; 
     107                        wait for 5 ns; 
     108                         
     109                        wait; 
    73110 
    74                         wait for 5 ns; 
     111                end process enter_inputs; 
     112 
     113end architecture test_fa_tb; 
    75114 
    76115 
    77                 end process set_inputs; 
    78                          
    79  
    80  
    81  
    82  
    83  
    84 end architecture test_fa_tb;