projects
/
fleet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ad838db
)
Stack bugfixes
author
adam
<adam@megacz.com>
Mon, 26 Feb 2007 11:56:08 +0000
(12:56 +0100)
committer
adam
<adam@megacz.com>
Mon, 26 Feb 2007 11:56:08 +0000
(12:56 +0100)
ships/Stack.ship
patch
|
blob
|
history
tests/stack/stack-test.fleet
patch
|
blob
|
history
diff --git
a/ships/Stack.ship
b/ships/Stack.ship
index
58d5e12
..
a3bb7ef
100644
(file)
--- a/
ships/Stack.ship
+++ b/
ships/Stack.ship
@@
-37,21
+37,25
@@
process any new {\tt pop} operations.
reg [(`DATAWIDTH-1):0] mem [4:0];
reg [5:0] depth;
reg [(`DATAWIDTH-1):0] mem [4:0];
reg [5:0] depth;
+ reg skip;
+ initial depth = 0;
always @(posedge clk) begin
always @(posedge clk) begin
- if (depth < 32) begin
- `onread(push_r, push_a)
- pop_d = push_d;
- mem[depth] <= push_d;
- depth = depth + 1;
- end
- end
+ skip = 0;
if (depth > 0) begin
if (depth > 0) begin
- `onwrite(pop_r, pop_d)
- depth = depth - 1;
- if (depth > 0) begin
- pop_d = mem[depth];
+ `onwrite(pop_r, pop_a)
+ if (depth > 1) begin
+ pop_d <= mem[depth-2];
end
end
+ depth <= depth - 1;
+ skip = 1;
+ end
+ end
+ if (!skip && depth < 32) begin
+ `onread(push_r, push_a)
+ pop_d <= push_d;
+ mem[depth] <= push_d;
+ depth <= depth + 1;
end
end
end
end
end
end
diff --git
a/tests/stack/stack-test.fleet
b/tests/stack/stack-test.fleet
index
835ffc0
..
8cd24b1
100644
(file)
--- a/
tests/stack/stack-test.fleet
+++ b/
tests/stack/stack-test.fleet
@@
-7,15
+7,18
@@
#expect 1
#expect 0
#expect 1
#expect 0
+debug.in: [*] take, deliver;
stack.push: [5] take, deliver; notify stack.pop;
stack.push: [5] take, deliver; notify stack.pop;
+stack.pop: wait; [*] take, sendto debug.in;
+
0: sendto stack.push;
1: sendto stack.push;
2: sendto stack.push;
3: sendto stack.push;
4: sendto stack.push;
0: sendto stack.push;
1: sendto stack.push;
2: sendto stack.push;
3: sendto stack.push;
4: sendto stack.push;
-stack.pop: wait; [*] take, sendto debug.in;
-debug.in: [*] take, deliver;
+
+