Ignore:
Timestamp:
Dec 10, 2008, 7:31:39 PM (15 years ago)
Author:
rosiere
Message:

Almost complete design
with Test and test platform

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Signal.h

    r82 r88  
    3838                UINT64_T                   } type_info_t;
    3939
    40   typedef enum {PORT_VHDL_YES_TESTBENCH_YES,
     40  typedef enum {PORT_SYSTEMC_NO            , // also, vhdl_no and testbench_no
     41                PORT_VHDL_YES_TESTBENCH_YES,
    4142                PORT_VHDL_YES_TESTBENCH_NO ,
    4243                PORT_VHDL_NO_TESTBENCH_YES ,
     
    7273
    7374    // -----[ methods ]---------------------------------------------------
    74   public    :                   Signal          (std::string          name          ,
    75                                                  direction_t     direction     ,
    76                                                  uint32_t        size          ,
    77                                                  presence_port_t presence_port = PORT_VHDL_YES_TESTBENCH_YES);
    78   public    :                   Signal          (const Signal &);
    79   public    :                   ~Signal         ();
     75  public    :                   Signal                  (std::string     name          ,
     76                                                         direction_t     direction     ,
     77                                                         uint32_t        size          ,
     78                                                         presence_port_t presence_port = PORT_VHDL_YES_TESTBENCH_YES);
     79  public    :                   Signal                  (const Signal &);
     80  public    :                   ~Signal                 ();
    8081
    8182  public    : std::string       get_name                (void);
     
    9394
    9495  public    : bool              test_map                (uint32_t depth, bool top_level, bool is_behavioural);
    95 //   public    : bool              test_equi               (uint32_t depth);
     96//public    : bool              test_equi               (uint32_t depth);
    9697
    9798  public    : void              link                    (Signal * signal_dest,
     
    108109        case IN  : {return read_in  <T>();}
    109110        case OUT : {return read_out <T>();}
    110         default  : throw (ErrorMorpheo ("Signal \""+_name+"\" : direction unknow."));
     111        default  : throw (ErrorMorpheo ("Signal \""+_name+"\" : direction unknow.\n"));
    111112        }
    112113    }
     
    122123        case UINT32_T : return (static_cast<sc_in  <uint32_t> *>(_sc_signal_map)->read());
    123124        case UINT64_T : return (static_cast<sc_in  <uint64_t> *>(_sc_signal_map)->read());
    124         default       : throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow."));
     125        default       : throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.\n"));
    125126        }
    126127    }
     
    136137        case UINT32_T : return (static_cast<sc_out <uint32_t> *>(_sc_signal_map)->read());
    137138        case UINT64_T : return (static_cast<sc_out <uint64_t> *>(_sc_signal_map)->read());
    138         default       : throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow."));
     139        default       : throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.\n"));
    139140        }
    140141    }
     
    148149
    149150      if (_type_info != UNKNOW)
    150         throw (ErrorMorpheo ("Signal \""+_name+"\" : already allocate."));
     151        throw (ErrorMorpheo (toString(_("Signal \"%s\" : already allocate.\n"),_name.c_str())));
    151152
    152153      if (test<T>(_size) == false)
    153         throw (ErrorMorpheo ("Signal \""+_name+"\" : size is too small to the associate type."));
     154        throw (ErrorMorpheo (toString(_("Signal \"%s\" : size is too small (%d bits) to the associate type (%d bits).\n"),_name.c_str(),_size,8*sizeof(T))));
    154155
    155156      _is_allocate    = true;
     
    157158      _sc_signal_map  = sc_signal;
    158159
    159       log_printf(TRACE,Behavioural,FUNCTION, "Allocation of %s - %.8x", _name.c_str(), (uint32_t)(_sc_signal_map));
    160 
    161160      if (typeid(T) == typeid(bool    ))
    162161        _type_info = BOOL;
     
    175174      else
    176175        _type_info = UNKNOW;
     176
     177      log_printf(TRACE,Behavioural,FUNCTION, "Allocation of %s (%s, 0x%.8x)", _name.c_str(),toString(_type_info).c_str(), static_cast<uint32_t>(reinterpret_cast<uint64_t>(_sc_signal_map)));
    177178
    178179      log_printf(FUNC,Behavioural,FUNCTION,"End");
     
    204205  };
    205206}; // end namespace behavioural         
     207
     208
     209
    206210
    207211  template<>           inline std::string toString<morpheo::behavioural::presence_port_t>(const morpheo::behavioural::presence_port_t& x)
     
    221225  }
    222226
     227  typedef enum {UNKNOW                     ,
     228                BOOL                       ,
     229                UINT8_T                    ,
     230                UINT16_T                   ,
     231                UINT32_T                   ,
     232                UINT64_T                   } type_info_t;
     233
     234  template<>           inline std::string toString<morpheo::behavioural::type_info_t>(const morpheo::behavioural::type_info_t& x)
     235  {
     236    switch (x)
     237      {
     238      case morpheo::behavioural::BOOL     : return "bool"    ; break;
     239      case morpheo::behavioural::UINT8_T  : return "uint8_t" ; break;
     240      case morpheo::behavioural::UINT16_T : return "uint16_t"; break;
     241      case morpheo::behavioural::UINT32_T : return "uint32_t"; break;
     242      case morpheo::behavioural::UINT64_T : return "uint64_t"; break;
     243      case morpheo::behavioural::UNKNOW   :
     244      default                             : return "unknow"  ; break;
     245      }
     246  }
     247
    223248}; // end namespace morpheo             
    224249
Note: See TracChangeset for help on using the changeset viewer.