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 | |
---|
17 | void Counter::vhdl_body (Vhdl & vhdl) |
---|
18 | { |
---|
19 | log_printf(FUNC,Counter,"vhdl_body","Begin"); |
---|
20 | vhdl.set_body (""); |
---|
21 | |
---|
22 | for (uint32_t i=0; i<_param._nb_port; i++) |
---|
23 | { |
---|
24 | string counter_inc, counter_dec; |
---|
25 | |
---|
26 | if (_param._size_data > 1) |
---|
27 | { |
---|
28 | counter_inc = "in_COUNTER_DATA_"+toString(i)+"+1"; |
---|
29 | counter_dec = "in_COUNTER_DATA_"+toString(i)+"-1"; |
---|
30 | } |
---|
31 | else |
---|
32 | { |
---|
33 | counter_inc = "in_COUNTER_DATA_"+toString(i)+"+1"; |
---|
34 | counter_dec = "in_COUNTER_DATA_"+toString(i)+"-1"; |
---|
35 | } |
---|
36 | |
---|
37 | vhdl.set_body ("out_COUNTER_DATA_"+toString(i)+" <="); |
---|
38 | if (_param._size_data > 1) |
---|
39 | { |
---|
40 | vhdl.set_body ("\tin_COUNTER_DATA_"+toString(i)+"+1 when in_COUNTER_ADDSUB_"+toString(i)+" = '1' and in_COUNTER_DATA_"+toString(i)+" < cst_max else"); |
---|
41 | vhdl.set_body ("\tin_COUNTER_DATA_"+toString(i)+"-1 when in_COUNTER_ADDSUB_"+toString(i)+" = '0' and in_COUNTER_DATA_"+toString(i)+" > cst_min else"); |
---|
42 | vhdl.set_body ("\tin_COUNTER_DATA_"+toString(i)+";"); |
---|
43 | } |
---|
44 | else |
---|
45 | { |
---|
46 | vhdl.set_body ("\tin_COUNTER_ADDSUB_"+toString(i)+";"); |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | log_printf(FUNC,Counter,"vhdl_body","End"); |
---|
51 | }; |
---|
52 | |
---|
53 | }; // end namespace counter |
---|
54 | }; // end namespace generic |
---|
55 | |
---|
56 | }; // end namespace behavioural |
---|
57 | }; // end namespace morpheo |
---|
58 | #endif |
---|