[2] | 1 | #ifdef VHDL_TESTBENCH |
---|
| 2 | |
---|
| 3 | #ifndef morpheo_behavioural_Vhdl_Testbench_h |
---|
| 4 | #define morpheo_behavioural_Vhdl_Testbench_h |
---|
| 5 | |
---|
| 6 | /* |
---|
| 7 | * $Id$ |
---|
| 8 | * |
---|
| 9 | * [ Description ] |
---|
| 10 | * |
---|
| 11 | */ |
---|
| 12 | |
---|
| 13 | #include "Behavioural/include/Vhdl.h" |
---|
| 14 | #include "Include/ToString.h" |
---|
| 15 | #include "Include/ToBase2.h" |
---|
| 16 | #include <stdint.h> |
---|
| 17 | #include <iostream> |
---|
| 18 | #include <list> |
---|
| 19 | |
---|
| 20 | using namespace std; |
---|
| 21 | |
---|
| 22 | namespace morpheo { |
---|
| 23 | namespace behavioural { |
---|
| 24 | |
---|
| 25 | class Vhdl_Testbench |
---|
| 26 | { |
---|
| 27 | class label_t |
---|
| 28 | { |
---|
| 29 | public : const uint32_t _cycle; |
---|
| 30 | public : const string _label; |
---|
| 31 | |
---|
| 32 | label_t (uint32_t cycle, |
---|
| 33 | string label) : |
---|
| 34 | _cycle (cycle), |
---|
| 35 | _label (label) |
---|
| 36 | {}; |
---|
| 37 | }; |
---|
| 38 | |
---|
| 39 | // -----[ fields ]---------------------------------------------------- |
---|
| 40 | private : const string _name ; |
---|
| 41 | private : string _clock_name ; |
---|
| 42 | private : uint32_t _num_cycle ; |
---|
| 43 | |
---|
| 44 | private : uint32_t _size_input ; |
---|
| 45 | private : uint32_t _size_output; |
---|
| 46 | |
---|
| 47 | private : list<string> _list_input ; |
---|
| 48 | private : list<string> _list_input_cycle; |
---|
| 49 | private : list<uint32_t> _list_input_size ; |
---|
| 50 | private : list<string> _list_output; |
---|
| 51 | private : list<string> _list_output_cycle; |
---|
| 52 | private : list<uint32_t> _list_output_size ; |
---|
| 53 | private : list<bool> _list_test; |
---|
| 54 | private : list<string> _list_port; |
---|
| 55 | private : list<label_t> _list_label; |
---|
| 56 | |
---|
| 57 | private : list<uint32_t>::iterator _num_input ; |
---|
| 58 | private : list<uint32_t>::iterator _num_output; |
---|
| 59 | |
---|
| 60 | private : Vhdl * _vhdl; |
---|
| 61 | |
---|
| 62 | // -----[ methods ]--------------------------------------------------- |
---|
| 63 | public : Vhdl_Testbench (string name); |
---|
| 64 | public : virtual ~Vhdl_Testbench (); |
---|
| 65 | |
---|
| 66 | public : void generate_file (void); |
---|
| 67 | |
---|
| 68 | public : void set_port (string name , |
---|
| 69 | direction_t direction , |
---|
| 70 | uint32_t size ); |
---|
| 71 | public : void set_clock (string name , |
---|
| 72 | bool model_have_clock); |
---|
| 73 | public : void new_cycle (void); |
---|
| 74 | |
---|
| 75 | private : uint32_t get_input (void); |
---|
| 76 | private : void set_input (void); |
---|
| 77 | public : void add_input (uint32_t value ); |
---|
| 78 | |
---|
| 79 | private : uint32_t get_output (void); |
---|
| 80 | private : void set_output (void); |
---|
| 81 | public : void add_output (uint32_t value ); |
---|
| 82 | |
---|
| 83 | private : uint32_t get_test (void); |
---|
| 84 | public : void add_test (bool must_test ); |
---|
| 85 | |
---|
| 86 | private : void get_label (void); |
---|
| 87 | public : void add_label (string label ); |
---|
| 88 | |
---|
| 89 | private : void generate_process_clock (uint32_t counter ); |
---|
| 90 | private : void generate_instance (void); |
---|
| 91 | }; |
---|
| 92 | |
---|
| 93 | }; // end namespace behavioural |
---|
| 94 | }; // end namespace morpheo |
---|
| 95 | |
---|
| 96 | #endif |
---|
| 97 | #endif |
---|