x393
1.0
FPGAcodeforElphelNC393camera
simul_fifo.v
Go to the documentation of this file.
1
39
`timescale 1ns/1ps
40
41
module
simul_fifo
42
#(
43
parameter
integer
WIDTH
=
32
,
// total number of output bits
44
parameter
integer
DEPTH
=
64
,
// maximal number of words in FIFO
45
// parameter OUT_DELAY = 3.5,
46
parameter
integer
FIFO_DEPTH
=
DEPTH
+
1
47
// parameter integer DATA_2DEPTH=(1<<DATA_DEPTH)-1
48
)(
49
input
clk
,
50
input
reset
,
51
input
[
WIDTH
-
1
:
0
]
data_in
,
52
input
load
,
53
output
input_ready
,
54
output
[
WIDTH
-
1
:
0
]
data_out
,
55
output
valid
,
56
input
ready
);
57
58
reg
[
WIDTH
-
1
:
0
]
fifo
[
0
:
FIFO_DEPTH
-
1
];
59
integer
in_address
;
60
integer
out_address
;
61
integer
count
;
62
63
assign
data_out
=
fifo
[
out_address
];
64
assign
valid
=
count
!=
0
;
65
assign
input_ready
=
count
<
DEPTH
;
66
67
always
@ (
posedge
clk
or
posedge
reset
)
begin
68
if
(
reset
)
in_address
<=
0
;
69
else
if
(
load
)
in_address
<= (
in_address
==(
FIFO_DEPTH
-
1
))?
0
:
in_address
+
1
;
70
71
if
(
reset
)
out_address
<=
0
;
72
else
if
(
valid
&&
ready
)
out_address
<= (
out_address
==(
FIFO_DEPTH
-
1
))?
0
:
out_address
+
1
;
73
74
75
if
(
reset
)
count
<=
0
;
76
else
if
(!(
valid
&&
ready
) &&
load
)
count
<=
count
+
1
;
77
else
if
(
valid
&&
ready
&& !
load
)
count
<=
count
-
1
;
78
end
79
80
always
@ (
posedge
clk
)
begin
81
if
(
load
)
fifo
[
in_address
] <=
data_in
;
82
end
83
endmodule
simul_fifo.9213DEPTH
integer 9213DEPTH64
Definition:
simul_fifo.v:44
simul_fifo.9219input_ready
9219input_ready
Definition:
simul_fifo.v:53
simul_fifo.9218load
9218load
Definition:
simul_fifo.v:52
simul_fifo.9223fifo
[0:FIFO_DEPTH-1] 9223fiforeg[WIDTH-1:0]
Definition:
simul_fifo.v:58
simul_fifo.9214FIFO_DEPTH
integer 9214FIFO_DEPTHDEPTH+1
Definition:
simul_fifo.v:46
simul_fifo.9221valid
9221valid
Definition:
simul_fifo.v:55
simul_fifo.9216reset
9216reset
Definition:
simul_fifo.v:50
simul_fifo.9226count
9226countinteger
Definition:
simul_fifo.v:61
simul_fifo.9220data_out
[WIDTH-1:0] 9220data_out
Definition:
simul_fifo.v:54
simul_fifo
Definition:
simul_fifo.v:41
simul_fifo.9225out_address
9225out_addressinteger
Definition:
simul_fifo.v:60
simul_fifo.9215clk
9215clk
Definition:
simul_fifo.v:49
simul_fifo.9224in_address
9224in_addressinteger
Definition:
simul_fifo.v:59
simul_fifo.9217data_in
[WIDTH-1:0] 9217data_in
Definition:
simul_fifo.v:51
simul_fifo.9222ready
9222ready
Definition:
simul_fifo.v:56
simul_fifo.9212WIDTH
integer 9212WIDTH32
Definition:
simul_fifo.v:43
simulation_modules
simul_fifo.v
Generated by
1.8.12