OpenCores
URL https://opencores.org/ocsvn/connect-6/connect-6/trunk

Subversion Repositories connect-6

[/] [connect-6/] [trunk/] [XILINX/] [BUILD_SCC_SRCH/] [synth_src/] [q.cpp] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 sumanta.ch
 
2
//#ifdef PICO_SYNTH
3
//#define Q_ASSERT(_cond, _msg)
4
////#include <iostream>
5
//#include "pico.h"
6
//#include "q.hpp"
7
//#include "./shared.h"
8
//using namespace std;
9
//#else
10
///* not synthesizable */
11
//#include <iostream>
12
//#include <sstream>
13
//#include <string>
14
//#include <assert.h>
15
//
16
//static void debug_assert (bool cond, char * msg) {
17
//      if (!cond) {
18
//              printf("assert failed: %s\n", msg);
19
//              assert(0);
20
//      }
21
//}
22
//
23
//#define Q_ASSERT(_cond, _msg) debug_assert(_cond, _msg)
24
//#endif
25
//#define max_size 361
26
//#define ptr_bw 32
27
//FIFO(queue,AIMove);
28
//#pragma no_inter_loop_stream_analysis pico_stream_input_queue
29
//#pragma no_inter_loop_stream_analysis pico_stream_output_queue
30
//#pragma no_inter_task_stream_analysis pico_stream_input_queue
31
//#pragma no_inter_task_stream_analysis pico_stream_output_queue
32
//
33
//#pragma fifo_length queue 361
34
////template <class tp=AIMove, int max_size=128, int ptr_bw=32>
35
//
36
//  /* pop front of queue, returning the front data */
37
//  /* q is corrupted if pop when empty */
38
//  AIMove q::pop (){
39
//    /* assert that before pop, queue is not empty (underflow check) */
40
//    Q_ASSERT((!wrapped && (head < tail)) || (wrapped && (head >= tail)),
41
//              "queue underflowed");
42
//    AIMove d = pico_stream_input_queue();
43
//      //cout <<"pop: "<<head<<":"<<tail<<":"<<wrapped<<endl;
44
//    if (head == max_size-1) {
45
//      head = 0;
46
//      wrapped = false;
47
//    } else {
48
//      head = head + 1;
49
//    }
50
//    return d;
51
//  }
52
//
53
//  /* push data into back of queue */
54
//  /* q is corrupted if push when full */
55
//   void q::push (AIMove d){
56
//    pico_stream_output_queue(d);
57
//    if (tail == max_size-1) {
58
//      tail = 0;
59
//      wrapped = true;
60
//    } else {
61
//      tail = tail + 1;
62
//    }
63
//    /* assert that after push, queue is not empty (overflow check) */
64
//    Q_ASSERT((!wrapped && (head < tail)) || (wrapped && (head >= tail)),
65
//              "Queue overflowed") ;
66
//      //cout <<"push: "<<head<<":"<<tail<<":"<<wrapped<<endl;
67
//  }
68
//
69
//  /* return current size of the queue */
70
//  int q::size (){
71
//    if (wrapped) {
72
//      return (max_size - head) + (tail - 0);
73
//    } else {
74
//      return tail - head;
75
//    }
76
//  }
77
//q  moves_fifo;
78
//
79
//#include "shared.h"
80
//#include"q.hpp"
81
//
82
//#ifdef PICO_SYNTH
83
//#define Q_ASSERT(_cond, _msg)
84
//#include <iostream>
85
//#include "pico.h"
86
//using namespace std;
87
//#else
88
///* not synthesizable */
89
//#include <iostream>
90
//#include <sstream>
91
//#include <string>
92
//#include <assert.h>
93
//
94
//static void debug_assert (bool cond, char * msg) {
95
//      if (!cond) {
96
//              printf("assert failed: %s\n", msg);
97
//              assert(0);
98
//      }
99
//}
100
//
101
//#define Q_ASSERT(_cond, _msg) debug_assert(_cond, _msg)
102
//#endif
103
//FIFO(queue,AIMove);
104
//
105
//  /* pop front of queue, returning the front data */
106
//  /* q is corrupted if pop when empty */
107
//  template<class tp, int max_size, int ptr_bw>
108
//  tp q<tp,max_size,ptr_bw>::pop () {
109
//    /* assert that before pop, queue is not empty (underflow check) */
110
//    Q_ASSERT((!wrapped && (head < tail)) || (wrapped && (head >= tail)),
111
//              "queue underflowed");
112
//    tp d = pico_stream_input_queue();
113
//      cout <<"pop: "<<head<<":"<<tail<<":"<<wrapped<<endl;
114
//    if (head == max_size-1) {
115
//      head = 0;
116
//      wrapped = false;
117
//    } else {
118
//      head = head + 1;
119
//    }
120
//    return d;
121
//  }
122
//
123
//  /* push data into back of queue */
124
//  /* q is corrupted if push when full */
125
//  template<class tp, int max_size, int ptr_bw>
126
//  void q<tp,max_size,ptr_bw>::push (tp d) {
127
//    pico_stream_output_queue(d);
128
//    if (tail == max_size-1) {
129
//      tail = 0;
130
//      wrapped = true;
131
//    } else {
132
//      tail = tail + 1;
133
//    }
134
//    /* assert that after push, queue is not empty (overflow check) */
135
//    Q_ASSERT((!wrapped && (head < tail)) || (wrapped && (head >= tail)),
136
//              "Queue overflowed") ;
137
//      cout <<"push: "<<head<<":"<<tail<<":"<<wrapped<<endl;
138
//  }
139
//
140
//  /* return current size of the queue */
141
//  template<class tp, int max_size, int ptr_bw>
142
//  int q<tp,max_size,ptr_bw>::size () {
143
//    if (wrapped) {
144
//      return (max_size - head) + (tail - 0);
145
//    } else {
146
//      return tail - head;
147
//    }
148
//  }
149
//
150
//#ifndef PICO_SYNTH 
151
//  /* not synthesizable */
152
//  std::string to_string () const {
153
//    std::string s;
154
//    std::stringstream out;
155
//
156
//    out << "{ ";
157
//
158
//    if (wrapped) {
159
//      for (int i=head; i<max_size; i++) {
160
//        out << arr[i];
161
//      out << " , ";
162
//      }
163
//      for (int i=0; i<tail; i++) {
164
//        out << arr[i];
165
//      if (i != tail - 1) out << " , ";
166
//      }
167
//    } else {
168
//      for (int i=head; i<tail; i++) {
169
//        out << arr[i];
170
//      if (i != tail - 1) out << " , ";
171
//      }
172
//    }
173
//
174
//    out << " }";
175
//    s = out.str();
176
//    return s; 
177
//  }
178
//
179
//  operator std::string () { return to_string(); }
180
//  
181
//#endif
182
//
183
//
184
//#ifndef PICO_SYNTH 
185
///* not synthesizable */
186
//template <class tp, int max_size, int ptr_bw>
187
//std::ostream& operator << (std::ostream &os, const q<tp,max_size,ptr_bw> &f)
188
//{
189
//  os << f.to_string();
190
//  return os;
191
//}
192
//#endif
193
//q moves_fifo;
194
//#pragma internal_blockram moves_fifo
195
//#pragma no_inter_loop_memory_analysis moves_fifo.head
196
//#pragma no_inter_loop_memory_analysis moves_fifo.tail
197
//#pragma no_inter_loop_memory_analysis moves_fifo.wrapped
198
//#pragma no_inter_loop_memory_analysis moves_fifo.active
199
//#pragma no_inter_loop_memory_analysis moves_fifo
200
//q moves_fifo1;
201
//#pragma internal_blockram moves_fifo1
202
//#pragma no_inter_loop_memory_analysis moves_fifo1.head
203
//#pragma no_inter_loop_memory_analysis moves_fifo1.tail
204
//#pragma no_inter_loop_memory_analysis moves_fifo1.wrapped
205
//#pragma no_inter_loop_memory_analysis moves_fifo1.active
206
//#pragma no_inter_loop_memory_analysis moves_fifo1

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.