1 | #ifdef VHDL |
---|
2 | /* |
---|
3 | * $Id$ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Generic/Counter/include/Counter.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace generic { |
---|
14 | namespace counter { |
---|
15 | |
---|
16 | void Counter::vhdl_body (Vhdl * & vhdl) |
---|
17 | { |
---|
18 | log_printf(FUNC,Counter,"vhdl_body","Begin"); |
---|
19 | vhdl->set_body (""); |
---|
20 | |
---|
21 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
22 | { |
---|
23 | std::string counter_inc, counter_dec; |
---|
24 | |
---|
25 | if (_param._size_data > 1) |
---|
26 | { |
---|
27 | counter_inc = "in_COUNTER_"+toString(i)+"_DATA+1"; |
---|
28 | counter_dec = "in_COUNTER_"+toString(i)+"_DATA-1"; |
---|
29 | } |
---|
30 | else |
---|
31 | { |
---|
32 | counter_inc = "in_COUNTER_"+toString(i)+"_DATA+1"; |
---|
33 | counter_dec = "in_COUNTER_"+toString(i)+"_DATA-1"; |
---|
34 | } |
---|
35 | |
---|
36 | vhdl->set_body ("out_COUNTER_"+toString(i)+"_DATA <="); |
---|
37 | if (_param._size_data > 1) |
---|
38 | { |
---|
39 | vhdl->set_body ("\tin_COUNTER_"+toString(i)+"_DATA+1 when in_COUNTER_"+toString(i)+"_ADDSUB = '1' and in_COUNTER_"+toString(i)+"_DATA < cst_max else"); |
---|
40 | vhdl->set_body ("\tin_COUNTER_"+toString(i)+"_DATA-1 when in_COUNTER_"+toString(i)+"_ADDSUB = '0' and in_COUNTER_"+toString(i)+"_DATA > cst_min else"); |
---|
41 | vhdl->set_body ("\tin_COUNTER_"+toString(i)+"_DATA;"); |
---|
42 | } |
---|
43 | else |
---|
44 | { |
---|
45 | vhdl->set_body ("\tin_COUNTER_"+toString(i)+"_ADDSUB;"); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | log_printf(FUNC,Counter,"vhdl_body","End"); |
---|
50 | }; |
---|
51 | |
---|
52 | }; // end namespace counter |
---|
53 | }; // end namespace generic |
---|
54 | |
---|
55 | }; // end namespace behavioural |
---|
56 | }; // end namespace morpheo |
---|
57 | #endif |
---|