[41] | 1 | #ifdef VHDL_TESTBENCH |
---|
| 2 | /* |
---|
| 3 | * $Id: Interface_fifo_testbench_test.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/include/Interface_fifo.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | |
---|
[75] | 14 | std::string Interface_fifo::testbench_test (Vhdl * & vhdl, |
---|
[88] | 15 | std::string counter_name, |
---|
| 16 | std::string reset_name ) |
---|
[41] | 17 | { |
---|
| 18 | log_printf(FUNC,Behavioural,"testbench_test","Begin"); |
---|
[75] | 19 | std::string test_name; |
---|
[41] | 20 | |
---|
| 21 | if (_test_exhaustive == true) |
---|
[42] | 22 | test_name = Interface::testbench_test(vhdl,counter_name,reset_name); |
---|
[41] | 23 | else |
---|
| 24 | { |
---|
| 25 | vhdl->set_body(""); |
---|
| 26 | vhdl->set_body("-- Test partial"); |
---|
| 27 | vhdl->set_body(""); |
---|
| 28 | |
---|
[88] | 29 | test_name = testbench_test_name (vhdl); |
---|
[75] | 30 | std::string test_name_tmp = test_name+"_tmp"; |
---|
| 31 | std::string test_name_ok = testbench_test_ok (vhdl); |
---|
| 32 | std::string test_transaction = testbench_test_transaction (vhdl); |
---|
[41] | 33 | |
---|
[42] | 34 | vhdl->set_signal(test_name_tmp,1); |
---|
| 35 | |
---|
[41] | 36 | if (_list_cycle->empty()== false) |
---|
| 37 | { |
---|
| 38 | vhdl->set_body ("with "+counter_name+" select"); |
---|
[42] | 39 | vhdl->set_body ("\t"+test_name_tmp+" <="); |
---|
[41] | 40 | |
---|
[75] | 41 | std::list<uint32_t>::iterator i = _list_cycle->begin(); |
---|
[41] | 42 | |
---|
| 43 | while (i != _list_cycle->end()) |
---|
| 44 | { |
---|
[42] | 45 | vhdl->set_body ("\t"+test_transaction+" and "+test_name_ok+" when "+toString(*i)+","); |
---|
[41] | 46 | ++i; |
---|
| 47 | } |
---|
[42] | 48 | vhdl->set_body ("\tnot "+test_transaction+" when others;"); |
---|
[41] | 49 | } |
---|
[42] | 50 | else |
---|
| 51 | vhdl->set_body (test_name_tmp+" <= not "+test_transaction+";"); |
---|
| 52 | |
---|
| 53 | vhdl->set_body(""); |
---|
| 54 | vhdl->set_body(test_name + " <= '1' when ("+reset_name+" = '0') else "+test_name_tmp+";"); |
---|
| 55 | |
---|
[88] | 56 | // #ifdef VHDL_TESTBENCH_ASSERT |
---|
| 57 | // if (_list_cycle->empty()== false) |
---|
| 58 | // { |
---|
| 59 | // vhdl->set_body(""); |
---|
| 60 | // vhdl->set_body("-- Assert ..."); |
---|
| 61 | // vhdl->set_body(""); |
---|
[42] | 62 | |
---|
[88] | 63 | // uint32_t j = 0; |
---|
| 64 | // std::list<uint32_t>::iterator i = _list_cycle->begin(); |
---|
[42] | 65 | |
---|
[88] | 66 | // while (i != _list_cycle->end()) |
---|
| 67 | // { |
---|
| 68 | // vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '1')) report \"***** <"+_name+"> Test number "+toString(j)+" is OK *****\" severity NOTE;"); |
---|
| 69 | // vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '0')) report \"@@@@@ <"+_name+"> Test number "+toString(j)+" is KO !!! @@@@@\" severity NOTE;"); |
---|
| 70 | // j++; |
---|
| 71 | // ++i; |
---|
| 72 | // } |
---|
[42] | 73 | |
---|
[88] | 74 | // vhdl->set_body(""); |
---|
| 75 | // } |
---|
| 76 | // #endif |
---|
[41] | 77 | } |
---|
| 78 | |
---|
| 79 | log_printf(FUNC,Behavioural,"testbench_test","End"); |
---|
| 80 | |
---|
| 81 | return test_name; |
---|
| 82 | }; |
---|
| 83 | |
---|
| 84 | }; // end namespace behavioural |
---|
| 85 | }; // end namespace morpheo |
---|
| 86 | #endif |
---|