Skip to content

Commit 1874730

Browse files
committed
alt way to handle enable signal
1 parent 0a95995 commit 1874730

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

simlib/act/sources.act

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ export template<pbool INCLUDE_ENABLE; pint D_WIDTH, VALUE, SOURCE_ID; pbool LOG>
4646
defproc gen_source_static_en (chan!(int<D_WIDTH>) O; bool enable)
4747
{
4848
chp {
49+
[~INCLUDE_ENABLE -> enable+ [] else -> skip ];
4950
*[
5051
// wait on enable flag
51-
[~INCLUDE_ENABLE|enable];
52+
[enable];
5253

5354
O!VALUE;
5455

@@ -85,10 +86,11 @@ export template<pbool INCLUDE_ENABLE; pint D_WIDTH, OUT_CHANNELS, VALUE, SOURCE_
8586
defproc gen_source_static_multi_en (chan!(int<D_WIDTH>) O[OUT_CHANNELS]; bool enable)
8687
{
8788
chp {
89+
[~INCLUDE_ENABLE -> enable+ [] else -> skip ];
8890
(, i : OUT_CHANNELS :
8991
*[
9092
// wait on enable flag
91-
[~INCLUDE_ENABLE|enable];
93+
[enable];
9294

9395
O[i]!VALUE;
9496

@@ -133,14 +135,15 @@ defproc gen_source_sequence_en (chan!(int<D_WIDTH>) O; bool enable)
133135
int<D_WIDTH> buf;
134136

135137
chp {
138+
[~INCLUDE_ENABLE -> enable+ [] else -> skip ];
136139
*[
137140
i := 0;
138141
*[ i < N ->
139142
// select the right element
140143
[([]k:N: i=k -> buf := DATA[k])];
141144

142145
// wait on enable flag
143-
[~INCLUDE_ENABLE|enable];
146+
[enable];
144147

145148
// and send it
146149
O!buf;
@@ -195,6 +198,7 @@ defproc gen_source_sequence_multi_en (chan!(int<D_WIDTH>) O[OUT_CHANNELS]; bool
195198
int<D_WIDTH> buf;
196199

197200
chp {
201+
[~INCLUDE_ENABLE -> enable+ [] else -> skip ];
198202
*[
199203
i := 0;
200204

@@ -204,7 +208,7 @@ defproc gen_source_sequence_multi_en (chan!(int<D_WIDTH>) O[OUT_CHANNELS]; bool
204208
[([]k:N: i=k -> buf := DATA[k])];
205209

206210
// wait on enable flag
207-
[~INCLUDE_ENABLE|enable];
211+
[enable];
208212

209213
// and send it to every channel
210214
(, j : OUT_CHANNELS :
@@ -271,6 +275,7 @@ defproc gen_source_file_en (chan!(int<D_WIDTH>) O; bool enable)
271275
bool success;
272276

273277
chp {
278+
[~INCLUDE_ENABLE -> enable+ [] else -> skip ];
274279
// if we are set to loop, loop forever
275280
*[
276281

@@ -281,7 +286,7 @@ defproc gen_source_file_en (chan!(int<D_WIDTH>) O; bool enable)
281286
// read until the file reports EOF and send it to the output channel
282287
*[
283288
// wait on enable flag
284-
[~INCLUDE_ENABLE|enable];
289+
[enable];
285290

286291
// read, then send the value
287292
buf := file_private::read(reader_id);
@@ -344,6 +349,7 @@ defproc gen_source_file_multi_en (chan!(int<D_WIDTH>) O[OUT_CHANNELS]; bool enab
344349

345350
chp {
346351
// if we are set to loop, loop forever
352+
[~INCLUDE_ENABLE -> enable+ [] else -> skip ];
347353
*[
348354

349355
// open the file and get a reader ID
@@ -353,7 +359,7 @@ defproc gen_source_file_multi_en (chan!(int<D_WIDTH>) O[OUT_CHANNELS]; bool enab
353359
// read until the file reports EOF and send it to the output channel
354360
*[
355361
// wait on enable flag
356-
[~INCLUDE_ENABLE|enable];
362+
[enable];
357363

358364
buf := file_private::read(reader_id);
359365

0 commit comments

Comments
 (0)