generic stack reset
This commit is contained in:
@@ -5,6 +5,7 @@ module VX_generic_stack
|
|||||||
)
|
)
|
||||||
(
|
(
|
||||||
input wire clk,
|
input wire clk,
|
||||||
|
input wire reset,
|
||||||
input wire push,
|
input wire push,
|
||||||
input wire pop,
|
input wire pop,
|
||||||
input reg [WIDTH - 1:0] q1,
|
input reg [WIDTH - 1:0] q1,
|
||||||
@@ -16,10 +17,12 @@ module VX_generic_stack
|
|||||||
reg [DEPTH - 1:0] ptr;
|
reg [DEPTH - 1:0] ptr;
|
||||||
reg [WIDTH - 1:0] stack [0:(1 << DEPTH) - 1];
|
reg [WIDTH - 1:0] stack [0:(1 << DEPTH) - 1];
|
||||||
|
|
||||||
|
integer i;
|
||||||
always @(posedge clk) begin
|
always @(posedge clk) begin
|
||||||
// if (reset)
|
if (reset) begin
|
||||||
// ptr <= 0;
|
ptr <= 0;
|
||||||
// else
|
for (i = 0; i < (1 << DEPTH); i=i+1) stack[i] <= 0;
|
||||||
|
end else
|
||||||
if (push)
|
if (push)
|
||||||
ptr <= ptr + 2;
|
ptr <= ptr + 2;
|
||||||
else if (pop)
|
else if (pop)
|
||||||
|
|||||||
Reference in New Issue
Block a user