x393
1.0
FPGAcodeforElphelNC393camera
dct1d_chen_reorder_in.v
Go to the documentation of this file.
1
39
`timescale 1ns/1ps
40
41
module
dct1d_chen_reorder_in
#(
42
parameter
WIDTH
=
24
43
)(
44
input
clk
,
45
input
rst
,
46
input
en
,
// to be sampled when start is expected (start time slot)
47
input
[
WIDTH
-
1
:
0
]
din
,
48
input
start
,
// with first pixel
49
output
[
2
*
WIDTH
-
1
:
0
]
dout_10_32_76_54
,
// Concatenated/reordered output data {x[1],x[0]}/{x[3],x[2]}/ {x[7],x[6]}/{x[5],x[4]}
50
output
reg
start_out
,
51
output
en_out
// to be sampled when start_out is expected
52
);
53
reg
last_r
;
54
reg
[
2
:
0
]
cntr_in
;
55
reg
[
1
:
0
]
raddr
;
56
wire
restart
= !
rst
&&
en
&& (
start
||
last_r
);
57
// wire [1:0] we = ((|cntr_in) || en)? {~cntr_in[0]^cntr_in[2],cntr_in[0]^cntr_in[2]}:2'b0;
58
wire
[
1
:
0
]
we
= ((|
cntr_in
) ||
en
)? {
cntr_in
[
0
]^
cntr_in
[
2
], ~
cntr_in
[
0
]^
cntr_in
[
2
]}:
2'b0
;
59
wire
[
1
:
0
]
waddr
= {
cntr_in
[
2
],
cntr_in
[
2
]^
cntr_in
[
1
]};
60
reg
[
WIDTH
-
1
:
0
]
bufl_ram
[
0
:
3
];
61
reg
[
WIDTH
-
1
:
0
]
bufh_ram
[
0
:
3
];
62
reg
[
2
*
WIDTH
-
1
:
0
]
dout_10_32_76_54_r
;
63
reg
first_period
;
64
reg
en_out_r
;
65
reg
last_out
;
66
reg
re_r
;
67
assign
dout_10_32_76_54
=
dout_10_32_76_54_r
;
68
assign
en_out
=
en_out_r
;
69
70
always
@(
posedge
clk
)
begin
71
if
(
rst
)
last_r
<=
0
;
72
else
last_r
<= &
cntr_in
;
73
74
last_out
<=
raddr
==
2
;
75
76
if
(
rst
)
re_r
<=
0
;
77
else
if
(
cntr_in
==
5
)
re_r
<=
1
;
78
else
if
(
last_out
)
re_r
<=
0
;
79
80
if
(
rst
)
cntr_in
<=
0
;
81
else
if
(
restart
|| (|
cntr_in
))
cntr_in
<=
cntr_in
+
1
;
82
83
if
(
we
[
0
])
bufl_ram
[
waddr
] <=
din
;
84
if
(
we
[
1
])
bufh_ram
[
waddr
] <=
din
;
85
86
if
(
rst
)
raddr
<= ~
0
;
87
else
if
(
cntr_in
==
5
)
raddr
<=
0
;
88
else
if
(!(&
raddr
))
raddr
<=
raddr
+
1
;
89
90
if
(
rst
)
first_period
<=
0
;
91
else
if
(
start
&&
en
)
first_period
<=
1
;
92
else
if
(
last_r
)
first_period
<=
0
;
93
94
if
(
re_r
)
dout_10_32_76_54_r
<= {
bufh_ram
[
raddr
],
bufl_ram
[
raddr
]};
95
96
start_out
<=
first_period
&& (
cntr_in
==
5
);
97
98
if
(
rst
)
en_out_r
<=
0
;
99
else
if
(
cntr_in
==
5
)
en_out_r
<=
1
;
100
else
if
((
raddr
==
2
) && !
en
)
en_out_r
<=
0
;
101
102
end
103
endmodule
104
dct1d_chen_reorder_in.3241last_out
3241last_outreg
Definition:
dct1d_chen_reorder_in.v:65
dct1d_chen_reorder_in.3228start_out
reg 3228start_out
Definition:
dct1d_chen_reorder_in.v:50
dct1d_chen_reorder_in.3236bufl_ram
[0:3] 3236bufl_ramreg[WIDTH-1:0]
Definition:
dct1d_chen_reorder_in.v:60
dct1d_chen_reorder_in.3225din
[WIDTH -1:0] 3225din
Definition:
dct1d_chen_reorder_in.v:47
dct1d_chen_reorder_in.3227dout_10_32_76_54
[2*WIDTH -1:0] 3227dout_10_32_76_54
Definition:
dct1d_chen_reorder_in.v:49
dct1d_chen_reorder_in.3232raddr
3232raddrreg[1:0]
Definition:
dct1d_chen_reorder_in.v:55
dct1d_chen_reorder_in.3233restart
3233restartwire
Definition:
dct1d_chen_reorder_in.v:56
dct1d_chen_reorder_in.3224en
3224en
Definition:
dct1d_chen_reorder_in.v:46
dct1d_chen_reorder_in.3242re_r
3242re_rreg
Definition:
dct1d_chen_reorder_in.v:66
dct1d_chen_reorder_in.3221WIDTH
3221WIDTH24
Definition:
dct1d_chen_reorder_in.v:42
dct1d_chen_reorder_in.3223rst
3223rst
Definition:
dct1d_chen_reorder_in.v:45
dct1d_chen_reorder_in.3222clk
3222clk
Definition:
dct1d_chen_reorder_in.v:44
dct1d_chen_reorder_in.3239first_period
3239first_periodreg
Definition:
dct1d_chen_reorder_in.v:63
dct1d_chen_reorder_in.3235waddr
3235waddrwire[1:0]
Definition:
dct1d_chen_reorder_in.v:59
dct1d_chen_reorder_in.3237bufh_ram
[0:3] 3237bufh_ramreg[WIDTH-1:0]
Definition:
dct1d_chen_reorder_in.v:61
dct1d_chen_reorder_in.3238dout_10_32_76_54_r
3238dout_10_32_76_54_rreg[2*WIDTH-1:0]
Definition:
dct1d_chen_reorder_in.v:62
dct1d_chen_reorder_in.3234we
3234wewire[1:0]
Definition:
dct1d_chen_reorder_in.v:58
dct1d_chen_reorder_in.3240en_out_r
3240en_out_rreg
Definition:
dct1d_chen_reorder_in.v:64
dct1d_chen_reorder_in.3229en_out
3229en_out
Definition:
dct1d_chen_reorder_in.v:51
dct1d_chen_reorder_in.3226start
3226start
Definition:
dct1d_chen_reorder_in.v:48
dct1d_chen_reorder_in
Definition:
dct1d_chen_reorder_in.v:41
dct1d_chen_reorder_in.3230last_r
3230last_rreg
Definition:
dct1d_chen_reorder_in.v:53
dct1d_chen_reorder_in.3231cntr_in
3231cntr_inreg[2:0]
Definition:
dct1d_chen_reorder_in.v:54
dsp
dct1d_chen_reorder_in.v
Generated by
1.8.12