source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_std_logic.cpp @ 66

Last change on this file since 66 was 66, checked in by rosiere, 17 years ago
  • un pas de plus vers la compatibilite avec systemC
  • modification de l'interface de read_queue : context_id devient context_id, front_end_id et ooo_engine_id
File size: 2.3 KB
RevLine 
[2]1#ifdef VHDL
2
3/*
4 * $Id$
5 *
6 * [ Description ]
7 *
8 */
9
10#include <math.h>
11#include "Behavioural/include/Vhdl.h"
12
13namespace morpheo              {
14namespace behavioural          {
15
[43]16#undef  FUNCTION
17#define FUNCTION "Vhdl::std_logic"
[2]18  string std_logic (uint32_t size)
19  {
[43]20    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
21
[2]22    string type;
23
24    if (size == 1)
25      type = "std_logic";
26    else
27      type = "std_logic_vector(" + toString(size-1) + " downto 0)";
28
[43]29    log_printf(FUNC,Behavioural,FUNCTION,"End");
30
[2]31    return type;
32  };
33
[43]34#undef  FUNCTION
35#define FUNCTION "Vhdl::std_logic_conv"
[2]36  string std_logic_conv (uint32_t size, string value)
37  {
[43]38    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
39
[2]40    string conv;
41
42    if (size == 1)
43      conv = "'"+toString(value)+"'";
44    else
45      conv = "conv_std_logic_vector("+value+","+toString(size)+")";
46
[43]47    log_printf(FUNC,Behavioural,FUNCTION,"End");
48
[2]49    return conv;
50  };
51
52  string std_logic_conv (uint32_t size, uint32_t value)
53  {
[43]54    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
[66]55    cout << toString(value) << endl;
[43]56    string _return = std_logic_conv(size,toString(value));
57    log_printf(FUNC,Behavioural,FUNCTION,"End");
58
59    return _return;
[2]60  };
61
[43]62#undef  FUNCTION
63#define FUNCTION "Vhdl::std_logic_range"
[2]64  string std_logic_range (uint32_t max, uint32_t min)
65  {
[43]66    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
[2]67    string type;
68
[57]69    if (max == 0)
70      type = "";
[2]71    else
[57]72      if (max == min)
73        type = "("+toString(max)+")";
74      else
75        type = "("+toString(max)+" downto "+toString(min)+")";
[2]76
[43]77    log_printf(FUNC,Behavioural,FUNCTION,"End");
78
[2]79    return type;
80  };
81
82  string std_logic_range (uint32_t size)
83  {
[43]84    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
85    string _return = std_logic_range(size-1,0);
86    log_printf(FUNC,Behavioural,FUNCTION,"End");
87
88    return _return;
[2]89  }
90
[43]91#undef  FUNCTION
92#define FUNCTION "Vhdl::std_logic_others"
[2]93  string std_logic_others (uint32_t size, uint32_t cst  )
94  {
[43]95    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
96
97    string _return;
98
[2]99    if (size < 2)
[43]100      _return = "'"+toString(cst)+"'";
[2]101    else
[43]102      _return = "(others => '"+toString(cst)+"')";
103
104    log_printf(FUNC,Behavioural,FUNCTION,"End");
105
106    return _return;
[2]107  }
108}; // end namespace behavioural         
109}; // end namespace morpheo             
110
111#endif
Note: See TracBrowser for help on using the repository browser.