OpenCores
URL https://opencores.org/ocsvn/unconfuser/unconfuser/trunk

Subversion Repositories unconfuser

[/] [unconfuser/] [trunk/] [fifoOneFlag.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 protik
module fifooneflag(clk, reset, push, din,pull, empty, dout, addrw, mdin, write, addrr, mdout);
2
 
3
//`timescale 1ns/100ps
4
 
5
input clk, reset, push, pull;
6
input [7:0] din, mdout;
7
output empty, write;
8
output[7:0] dout, mdin;
9
output[15:0] addrw, addrr;
10
 
11
//wire full;
12
wire empty;
13
 
14
wire write;
15
wire read;
16
wire [7:0] dout;
17
wire [7:0] mdin;
18
reg [15:0] addrw, addrr;
19
 
20
//write
21
assign write = push;
22
assign mdin = din;
23
 
24
//write address
25
always @(posedge clk or posedge reset)
26
begin
27
if(reset) begin
28
addrw <= 16'h0;
29
end
30
else if(write == 1'b1)
31
addrw <= #1 addrw + 1;
32
end
33
 
34
//read
35
assign read = empty ? 1'b0 : pull;
36
assign dout = mdout;
37
 
38
//read address
39
always @(posedge clk or posedge reset)
40
begin
41
if(reset)
42
addrr <= 16'h0;
43
else if(read == 1'b1)
44
addrr <= #1 addrr + 1;
45
end
46
 
47
//Full
48
//assign full = ( (addrw+1) == addrr);
49
//Empty
50
assign empty = (addrw == addrr);
51
 
52
endmodule
53
 

powered by: WebSVN 2.1.0

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