source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_vhdl_body.cpp @ 2

Last change on this file since 2 was 2, checked in by kane, 17 years ago

Import Morpheo

File size: 1.4 KB
Line 
1#ifdef VHDL
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Generic/Counter/include/Counter.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace generic {
14namespace 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
Note: See TracBrowser for help on using the repository browser.