-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRound.v
More file actions
28 lines (25 loc) · 764 Bytes
/
Round.v
File metadata and controls
28 lines (25 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Round
#( parameter BufferWidth = 4,
parameter BufferSize = 16)
(clk, aclr, Push, Pop, W_Addr, R_Addr, Round);
input clk, aclr, Push, Pop;
input [BufferWidth-1:0] W_Addr, R_Addr;
output reg Round;
wire W_ADDR_EQUALS_TO_BUFFER_SIZE = (W_Addr == BufferSize - 1);
wire R_ADDR_EQUALS_TO_BUFFER_SIZE = (R_Addr == BufferSize - 1);
always @(posedge clk , posedge aclr)
begin
if(aclr) begin
Round <= 1'b 0;
end
else if(W_ADDR_EQUALS_TO_BUFFER_SIZE && Push) begin
Round <= 1'b 1;
end
else if (R_ADDR_EQUALS_TO_BUFFER_SIZE && Pop) begin
Round <= 1'b 0 ;
end
else begin
Round <= Round;
end
end
endmodule