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

Subversion Repositories unconfuser

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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