Commit 7ea165ed authored by royus's avatar royus
Browse files
parents 15c7ffdd 30e9b8f6
Loading
Loading
Loading
Loading

makefile

0 → 100644
+2 −0
Changes for makefile: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
all: main.c io.c solver.c
	gcc -o adc main.c io.c solver.c

router/Makefile

0 → 100755
+14 −0
Changes for router/Makefile: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
TARGET = sim
OBJS = $(CPPS:.cpp=.o)
CPPS = $(wildcard *.cpp)
CXX = g++
CXXFLAGS = -O3 -DSOFTWARE

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CXX) -o $@ $(OBJS)

clean:
	rm *.o
	rm $(TARGET)

router/README.md

0 → 100644
+64 −0
Changes for router/README.md: 64 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Basic router
* A*ベースの配線プログラム
* 入力
  * 盤面サイズ(size_x, size_y)
  * ライン数(line_num)
  * 盤面情報(size_x$`\times`$size_yの盤面に整数を割り当て,自然数: ライン端点,-1: 配線禁止領域, 0: 配線領域)
* 出力
  * status(自然数: 配線成功,0: 配線失敗),配線成功時のstatusは総配線長を表す
  * 配線結果
* routerに渡す盤面情報,routerから返される配線結果は1次元配列(入力が2次元配列の場合,変換が必要)
* ハードウェア化に備えて余計な型やヘッダファイルを含むが,その辺はご了承願いたい...

### Change log
* 2019.07.16
  * 端点の隣接判定に関するバグを修正
  * 端点を結ぶパスが存在しないときにプログラムが停止するバグを修正
  * 配線成功時のstatusを総配線長に変更

### 関数呼び出し
* 関数routerの呼び出し方法は以下のサンプルコードの通り
* routerの第5引数はシード値で指定は任意(default=12345)

```
short int size_x = 10, size_y = 10;
short int line_num = 6;
short int board[10][10], board_str[100];

/* ここで盤面情報を設定 */

// Transform "board" to "board_str"
for(int y = 0; y < size_y; y++) {
	for(int x = 0; x < size_x; x++) {
		int idx = y * size_x + x;
		board_str[idx] = board[y][x];
	}
}

int status = router(size_x, size_y, line_num, board_str, 1234567);

// Transform "board_str" to "board"
for(int y = 0; y < size_y; y++) {
	for(int x = 0; x < size_x; x++) {
		int idx = y * size_x + x;
		board[y][x] = board_str[idx];
	}
}
```

### 必要ファイル
* router.cpp
* router.hpp
* ap_int.h
* etc/ap_fixed_sim.h
* etc/ap_int_sim.h
* etc/ap_private.h

### パラメタ
* router.hpp上部で以下を設定可能

|定数名|説明|
|:---|:---|
|ROUND_LIMIT|引きはがし再配線回数の上限(default: 32768, Max: 65534),小さいほど諦めが早い|
|PRINT_BOARD|配線前と配線後の盤面を表示(コメントアウトで非表示)|
|PRINT_SEARCH|配線の途中経過をすべて表示(コメントアウトで非表示)|

router/ap_int.h

0 → 100755
+521 −0
Changes for router/ap_int.h: 521 added lines, 0 removed lines.
Original line number Diff line number Diff line
/*
 * Copyright 2012 Xilinx, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __AESL_AP_SIM_H__
#define __AESL_AP_SIM_H__

#ifndef __cplusplus
#error C++ is required to include this header file
#else

#include "etc/ap_int_sim.h"
#include "etc/ap_fixed_sim.h"

//Forward declaration
template<int _AP_W, int _AP_I, ap_q_mode _AP_Q,
         ap_o_mode _AP_O, int _AP_N> class ap_fixed;
template<int _AP_W, int _AP_I, ap_q_mode _AP_Q,
         ap_o_mode _AP_O, int _AP_N> class ap_ufixed;
template<int _AP_W> class ap_int;
template<int _AP_W> class ap_uint;

//AP_INT
//--------------------------------------------------------
template<int _AP_W>
class ap_int : public ap_private<_AP_W, true> {
#ifdef _MSC_VER
#pragma warning(disable: 4521 4522)
#endif /* #ifdef _MSC_VER */
public:
    typedef ap_private<_AP_W, true> Base;

    //Constructor
    INLINE ap_int(): Base() {}
    template<int _AP_W2>
    INLINE ap_int(const volatile ap_int<_AP_W2> &op):Base((const ap_private<_AP_W2,true> &)(op)) {}

    template<int _AP_W2>
    INLINE ap_int(const ap_int<_AP_W2> &op):Base((const ap_private<_AP_W2,true> &)(op)) {}

    template<int _AP_W2>
    INLINE ap_int(const ap_uint<_AP_W2> &op):Base((const ap_private<_AP_W2,false> &)(op)) {}

    template<int _AP_W2>
    INLINE ap_int(const volatile ap_uint<_AP_W2> &op):Base((const ap_private<_AP_W2,false> &)(op)) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_int(const ap_range_ref<_AP_W2, _AP_S2>& ref):Base(ref) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_int(const ap_bit_ref<_AP_W2, _AP_S2>& ref):Base(ref) {}

    template<int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
    INLINE ap_int(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& ref):Base(ref) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_int(const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
                 :Base(op.to_ap_private()) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_int(const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
                  :Base(op.to_ap_private()) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_int(const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
                 :Base(op.to_ap_private()) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_int(const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
                  :Base(op.to_ap_private()) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_int(const ap_private<_AP_W2, _AP_S2>& op):Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_int(const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2,
                  _AP_N2>& op):Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_int(const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2,
                  _AP_N2>& op):Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_int(const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2,
                    _AP_Q2, _AP_O2, _AP_N2>& op):Base(op.to_ap_private()) {}

#define CTOR(TYPE) \
    INLINE ap_int(TYPE v):Base(v) {}
    CTOR(bool)
    CTOR(signed char)
    CTOR(unsigned char)
    CTOR(short)
    CTOR(unsigned short)
    CTOR(int)
    CTOR(unsigned int)
    CTOR(long)
    CTOR(unsigned long)
    CTOR(unsigned long long)
    CTOR(long long)
    CTOR(float)
    CTOR(double)
    CTOR(const char*)
    CTOR(const std::string&)
#undef CTOR
    INLINE ap_int(const char* str, signed char rd):Base(str, rd) {}
     //Assignment
     //Another form of "write"
    INLINE void operator = (const ap_int<_AP_W>& op2) volatile {
      const_cast<ap_int*>(this)->operator = (op2);
    }

    INLINE void operator = (const volatile ap_int<_AP_W>& op2) volatile {
      const_cast<Base*>(this)->operator = (op2);
    }

    INLINE ap_int<_AP_W>& operator = (const volatile ap_int<_AP_W>& op2) {
      Base::operator = (const_cast<ap_int<_AP_W>& >(op2));
        return *this;
    }

    INLINE ap_int<_AP_W>& operator = (const ap_int<_AP_W>& op2) {
      Base::operator = ((const ap_private<_AP_W, true>&)op2);
        return *this;
    }
};

//AP_UINT
//---------------------------------------------------------------
template<int _AP_W>
class ap_uint: public ap_private<_AP_W, false> {
#ifdef _MSC_VER
#pragma warning( disable : 4521 4522 )
#endif
public:
    typedef ap_private<_AP_W, false> Base;
    //Constructor
    INLINE ap_uint(): Base() {}
  INLINE ap_uint(const ap_uint<_AP_W>& op) :Base(dynamic_cast<const ap_private<_AP_W, false>&>(op)) {}
  INLINE ap_uint(const volatile ap_uint<_AP_W>& op):Base(dynamic_cast<const volatile ap_private<_AP_W, false>&>(op)){}
    template<int _AP_W2>
    INLINE ap_uint(const volatile ap_uint<_AP_W2> &op):Base((const ap_private<_AP_W2, false>&)(op)) {}

    template<int _AP_W2>
    INLINE ap_uint(const ap_uint<_AP_W2> &op) : Base((const ap_private<_AP_W2, false>&)(op)){}

    template<int _AP_W2>
    INLINE ap_uint(const ap_int<_AP_W2> &op) : Base((const ap_private<_AP_W2, true>&)(op)) {}

    template<int _AP_W2>
    INLINE ap_uint(const volatile ap_int<_AP_W2> &op) : Base((const ap_private<_AP_W2, false>&)(op)) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_uint(const ap_range_ref<_AP_W2, _AP_S2>& ref):Base(ref) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_uint(const ap_bit_ref<_AP_W2, _AP_S2>& ref):Base(ref) {}

    template<int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
    INLINE ap_uint(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& ref):Base(ref) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_uint(const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
                   :Base(op.to_ap_private()) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_uint(const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
                   :Base(op.to_ap_private()) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_uint(const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
                   :Base(op.to_ap_private()) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_uint(const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
                   :Base(op) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_uint(const ap_private<_AP_W2, _AP_S2>& op):Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_uint(const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2,
                  _AP_N2>& op):Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_uint(const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2,
                  _AP_N2>& op):Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_uint(const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2,
                    _AP_Q2, _AP_O2, _AP_N2>& op):Base(op.to_ap_private()) {}

#define CTOR(TYPE) \
    INLINE ap_uint(TYPE v):Base(v) {}
    CTOR(bool)
    CTOR(signed char)
    CTOR(unsigned char)
    CTOR(short)
    CTOR(unsigned short)
    CTOR(int)
    CTOR(unsigned int)
    CTOR(long)
    CTOR(unsigned long)
    CTOR(unsigned long long)
    CTOR(long long)
    CTOR(float)
    CTOR(double)
    CTOR(const char*)
    CTOR(const std::string&)
#undef CTOR
    INLINE ap_uint(const char* str, signed char rd):Base(str, rd) {}
     //Assignment
     //Another form of "write"
    INLINE void operator = (const ap_uint<_AP_W>& op2) volatile {
      Base::operator = (op2);
    }

    INLINE void operator = (const volatile ap_uint<_AP_W>& op2) volatile {
      Base::operator = (op2);
    }

    INLINE ap_uint<_AP_W>& operator = (const volatile ap_uint<_AP_W>& op2) {
      Base::operator = (op2);
        return *this;
    }

    INLINE ap_uint<_AP_W>& operator = (const ap_uint<_AP_W>& op2) {
      Base::operator = ((const ap_private<_AP_W, false>&)(op2));
        return *this;
    }
};

#define ap_bigint ap_int
#define ap_biguint ap_uint

//AP_FIXED
//---------------------------------------------------------------------
template<int _AP_W, int _AP_I, ap_q_mode _AP_Q = AP_TRN,
         ap_o_mode _AP_O = AP_WRAP, int _AP_N = 0>
class ap_fixed: public ap_fixed_base<_AP_W, _AP_I, true, _AP_Q, _AP_O, _AP_N> {
#ifdef _MSC_VER
#pragma warning( disable : 4521 4522 )
#endif
public:
    typedef ap_fixed_base<_AP_W, _AP_I, true, _AP_Q, _AP_O, _AP_N> Base;
     //Constructor
    INLINE ap_fixed():Base() {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
            ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_fixed(const ap_fixed<_AP_W2, _AP_I2,  _AP_Q2, _AP_O2,
                    _AP_N2>& op): Base(op) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_fixed(const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2,
                    _AP_N2>& op): Base(ap_fixed_base<_AP_W2, _AP_I2,
                   false, _AP_Q2, _AP_O2, _AP_N2>(op)) {}

    template<int _AP_W2>
    INLINE ap_fixed(const ap_int<_AP_W2>& op):
                   Base(ap_private<_AP_W2, true>(op)) {}

    template<int _AP_W2>
    INLINE ap_fixed(const ap_uint<_AP_W2>& op):Base(ap_private<_AP_W2, false>(op)) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
            ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_fixed(const volatile ap_fixed<_AP_W2, _AP_I2,  _AP_Q2, _AP_O2,
                    _AP_N2>& op): Base(ap_fixed_base<_AP_W2, _AP_I2,
                    true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_fixed(const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2,
                    _AP_N2>& op): Base(ap_fixed_base<_AP_W2, _AP_I2,
                   false, _AP_Q2, _AP_O2, _AP_N2>(op)) {}

    template<int _AP_W2>
    INLINE ap_fixed(const volatile ap_int<_AP_W2>& op):
                   Base(ap_private<_AP_W2, true>(op)) {}

    template<int _AP_W2>
    INLINE ap_fixed(const volatile ap_uint<_AP_W2>& op):Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_fixed(const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2,
                    _AP_Q2, _AP_O2, _AP_N2>& op):Base(op) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_fixed(const ap_bit_ref<_AP_W2, _AP_S2>& op):
                   Base(op) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_fixed(const ap_range_ref<_AP_W2, _AP_S2>& op):
                   Base(op) {}

    template<int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
    INLINE ap_fixed(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& op):
                   Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_fixed(const af_bit_ref<_AP_W2, _AP_I2, _AP_S2,
                    _AP_Q2, _AP_O2, _AP_N2>& op): Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_fixed(const af_range_ref<_AP_W2, _AP_I2, _AP_S2,
                    _AP_Q2, _AP_O2, _AP_N2>& op): Base(op) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_fixed(const ap_private<_AP_W2, _AP_S2>& op):Base(op) {}

 #define CTOR(TYPE) \
    INLINE ap_fixed(TYPE v):Base(v) {}
    CTOR(bool)
    CTOR(signed char)
    CTOR(unsigned char)
    CTOR(short)
    CTOR(unsigned short)
    CTOR(int)
    CTOR(unsigned int)
    CTOR(long)
    CTOR(unsigned long)
    CTOR(unsigned long long)
    CTOR(long long)
    CTOR(float)
    CTOR(double)
    CTOR(const char*)
    CTOR(const std::string&)
#undef CTOR
    INLINE ap_fixed(const char* str, signed char rd):Base(str, rd) {}

    //Assignment
    INLINE ap_fixed& operator = (const ap_fixed<_AP_W, _AP_I,
                    _AP_Q, _AP_O, _AP_N>& op) {
      Base::operator = (op);
        return *this;
    }

  INLINE ap_fixed& operator = (const volatile ap_fixed<_AP_W, _AP_I,
                    _AP_Q, _AP_O, _AP_N>& op) {
        Base::operator = (op);
        return *this;
    }
};

//AP_ UFIXED
//--- ----------------------------------------------------------------
template<int _AP_W, int _AP_I, ap_q_mode _AP_Q = AP_TRN,
         ap_o_mode _AP_O = AP_WRAP, int _AP_N = 0>
class ap_ufixed : public ap_fixed_base<_AP_W, _AP_I, false, _AP_Q, _AP_O, _AP_N> {
#ifdef _MSC_VER
#pragma warning(disable: 4521 4522)
#endif /* #ifdef _MSC_VER */
public:
    typedef ap_fixed_base<_AP_W, _AP_I, false, _AP_Q, _AP_O, _AP_N> Base;

     //Constructor
    INLINE ap_ufixed():Base() {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_ufixed(const ap_fixed<_AP_W2, _AP_I2, _AP_Q2,
                     _AP_O2, _AP_N2>& op) : Base(ap_fixed_base<_AP_W2,
                     _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_ufixed(const ap_ufixed<_AP_W2, _AP_I2,  _AP_Q2,
                     _AP_O2, _AP_N2>& op): Base(ap_fixed_base<_AP_W2, _AP_I2,
                      false, _AP_Q2, _AP_O2, _AP_N2>(op)) {}

    template<int _AP_W2>
    INLINE ap_ufixed(const ap_int<_AP_W2>& op):
      Base((const ap_private<_AP_W2, true>&)(op)) {}

    template<int _AP_W2>
    INLINE ap_ufixed(const ap_uint<_AP_W2>& op):
      Base((const ap_private<_AP_W2, false>&)(op)) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_ufixed(const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2,
                     _AP_O2, _AP_N2>& op) : Base(ap_fixed_base<_AP_W2,
                     _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}

    template<int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_ufixed(const volatile ap_ufixed<_AP_W2, _AP_I2,  _AP_Q2,
                     _AP_O2, _AP_N2>& op): Base(ap_fixed_base<_AP_W2, _AP_I2,
                      false, _AP_Q2, _AP_O2, _AP_N2>(op)) {}

    template<int _AP_W2>
    INLINE ap_ufixed(const volatile ap_int<_AP_W2>& op):
                     Base(ap_private<_AP_W2, true>(op)) {}

    template<int _AP_W2>
    INLINE ap_ufixed(const volatile ap_uint<_AP_W2>& op):
                     Base(ap_private<_AP_W2, false>(op)) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_ufixed(const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2,
                     _AP_O2, _AP_N2>& op):Base(op) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_ufixed(const ap_bit_ref<_AP_W2, _AP_S2>& op):
                   Base(op) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_ufixed(const ap_range_ref<_AP_W2, _AP_S2>& op):
                   Base(op) {}

    template<int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
    INLINE ap_ufixed(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& op):
                   Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_ufixed(const af_bit_ref<_AP_W2, _AP_I2, _AP_S2,
                    _AP_Q2, _AP_O2, _AP_N2>& op): Base(op) {}

    template<int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
             ap_o_mode _AP_O2, int _AP_N2>
    INLINE ap_ufixed(const af_range_ref<_AP_W2, _AP_I2, _AP_S2,
                    _AP_Q2, _AP_O2, _AP_N2>& op): Base(op) {}

    template<int _AP_W2, bool _AP_S2>
    INLINE ap_ufixed(const ap_private<_AP_W2, _AP_S2>& op):Base(op) {}

 #define CTOR(TYPE) \
    INLINE ap_ufixed(TYPE v):Base(v) {}
    CTOR(bool)
    CTOR(signed char)
    CTOR(unsigned char)
    CTOR(short)
    CTOR(unsigned short)
    CTOR(int)
    CTOR(unsigned int)
    CTOR(long)
    CTOR(unsigned long)
    CTOR(unsigned long long)
    CTOR(long long)
    CTOR(float)
    CTOR(double)
    CTOR(const char*)
    CTOR(const std::string&)
#undef CTOR
    INLINE ap_ufixed(const char* str, signed char rd):Base(str, rd) {}

    //Assignment
    INLINE ap_ufixed& operator = (const ap_ufixed<_AP_W, _AP_I,
                    _AP_Q, _AP_O, _AP_N>& op) {
      Base::operator = (op);
        return *this;
    }

    INLINE ap_ufixed& operator = (const volatile ap_ufixed<_AP_W, _AP_I,
                    _AP_Q, _AP_O, _AP_N>& op) {
        Base::V = const_cast<ap_ufixed&>(op);
        return *this;
    }
};

#if defined(SYSTEMC_H) || defined(SYSTEMC_INCLUDED)
template<int _AP_W>
INLINE void sc_trace(sc_core::sc_trace_file *tf, const ap_int<_AP_W> &op,
                     const std::string &name) {
    if (tf)
        tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
}

template<int _AP_W>
INLINE void sc_trace(sc_core::sc_trace_file *tf, const ap_uint<_AP_W> &op,
                     const std::string &name) {
    if (tf)
        tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
}

template<int _AP_W, int _AP_I, ap_q_mode _AP_Q,
         ap_o_mode _AP_O, int _AP_N>
INLINE void sc_trace(sc_core::sc_trace_file *tf, const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N >&op, const std::string &name) {
        tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
}

template<int _AP_W, int _AP_I, ap_q_mode _AP_Q,
         ap_o_mode _AP_O, int _AP_N>
INLINE void sc_trace(sc_core::sc_trace_file *tf, const ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N >&op, const std::string &name) {
        tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
}
#endif /* #if defined(SYSTEMC_H) || defined(SYSTEMC_INCLUDED) */
#endif /* #ifndef __cplusplus */
#endif /* #ifndef __AESL_AP_SIM_H__ */
 No newline at end of file
+2451 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading