x393
1.0
FPGAcodeforElphelNC393camera
imu_message393.v
Go to the documentation of this file.
1
44
`timescale 1ns/1ps
45
46
module
imu_message393
(
47
input
mclk
,
// system clock, negedge TODO:COnvert to posedge!
48
input
xclk
,
// half frequency (80 MHz nominal)
49
input
we
,
// write enable for registers to log (@negedge mclk), with lower data half
50
input
[
3
:
0
]
wa
,
// write address for register (4 bits, @negedge mclk)
51
// input [15:0] di, // 16-bit data in multiplexed
52
input
[
31
:
0
]
din
,
// 32-bit data in, non-multiplexed
53
input
en
,
// enable module operation, if 0 - reset
54
input
trig
,
// leading edge - sample time, trailing set rdy
55
output
ts
,
// timestamop request
56
output
rdy
,
// data ready
57
input
rd_stb
,
// data read strobe (increment address)
58
output
[
15
:
0
]
rdata
);
// data out (16 bits)
59
60
reg
[
4
:
0
]
raddr
;
61
reg
rdy_r
=
1'b0
;
62
reg
[
2
:
0
]
trig_d
;
63
reg
[
7
:
0
]
denoise_count
;
64
reg
[
1
:
0
]
trig_denoise
;
65
reg
ts_r
;
66
67
assign
rdy
=
rdy_r
;
68
assign
ts
=
ts_r
;
69
70
always
@ (
posedge
xclk
)
begin
71
if
(!
en
)
trig_d
[
2
:
0
] <=
3'h0
;
72
else
trig_d
[
2
:
0
] <= {
trig_d
[
1
:
0
],
trig
};
73
74
if
(!
en
)
trig_denoise
[
0
] <=
1'b0
;
75
else
if
(
denoise_count
[
7
:
0
]==
8'h0
)
trig_denoise
[
0
] <=
trig_d
[
2
];
76
77
if
(
trig_d
[
2
]==
trig_denoise
[
0
])
denoise_count
[
7
:
0
] <=
8'hff
;
78
else
denoise_count
[
7
:
0
] <=
denoise_count
[
7
:
0
] -
1
;
79
80
trig_denoise
[
1
] <=
trig_denoise
[
0
];
81
82
ts_r
<= !
trig_denoise
[
1
] &&
trig_denoise
[
0
];
83
84
if
(!
en
||
ts_r
)
raddr
[
4
:
0
] <=
5'h0
;
85
else
if
(
rd_stb
)
raddr
[
4
:
0
] <=
raddr
[
4
:
0
] +
1
;
86
87
if
(
ts_r
|| (
rd_stb
&& (
raddr
[
4
:
0
]==
5'h1b
)) || !
en
)
rdy_r
<=
1'b0
;
88
else
if
(
trig_denoise
[
1
] && !
trig_denoise
[
0
])
rdy_r
<=
1'b1
;
89
end
90
91
reg
[
31
:
0
]
odbuf0_ram
[
0
:
15
];
92
wire
[
31
:
0
]
odbuf0_ram_out
;
93
always
@ (
posedge
mclk
)
if
(
we
)
begin
94
odbuf0_ram
[
wa
[
3
:
0
]] <=
din
[
31
:
0
];
95
end
96
assign
odbuf0_ram_out
=
odbuf0_ram
[
raddr
[
4
:
1
]];
97
assign
rdata
[
15
:
0
] =
raddr
[
0
] ?
odbuf0_ram_out
[
15
:
0
] :
odbuf0_ram_out
[
31
:
16
];
98
99
endmodule
100
imu_message393.3593xclk
3593xclk
Definition:
imu_message393.v:48
imu_message393.3610odbuf0_ram_out
3610odbuf0_ram_outwire[31:0]
Definition:
imu_message393.v:92
imu_message393.3609odbuf0_ram
[0:15] 3609odbuf0_ramreg[31:0]
Definition:
imu_message393.v:91
imu_message393
Definition:
imu_message393.v:46
imu_message393.3596din
[31:0] 3596din
Definition:
imu_message393.v:52
imu_message393.3607trig_denoise
3607trig_denoisereg[1:0]
Definition:
imu_message393.v:64
imu_message393.3592mclk
3592mclk
Definition:
imu_message393.v:47
imu_message393.3608ts_r
3608ts_rreg
Definition:
imu_message393.v:65
imu_message393.3597en
3597en
Definition:
imu_message393.v:53
imu_message393.3600rdy
3600rdy
Definition:
imu_message393.v:56
imu_message393.3603raddr
3603raddrreg[4:0]
Definition:
imu_message393.v:60
imu_message393.3595wa
[3:0] 3595wa
Definition:
imu_message393.v:50
imu_message393.3601rd_stb
3601rd_stb
Definition:
imu_message393.v:57
imu_message393.3598trig
3598trig
Definition:
imu_message393.v:54
imu_message393.3599ts
3599ts
Definition:
imu_message393.v:55
imu_message393.3602rdata
[15:0] 3602rdata
Definition:
imu_message393.v:58
imu_message393.3604rdy_r
3604rdy_rreg
Definition:
imu_message393.v:61
imu_message393.3594we
3594we
Definition:
imu_message393.v:49
imu_message393.3606denoise_count
3606denoise_countreg[7:0]
Definition:
imu_message393.v:63
imu_message393.3605trig_d
3605trig_dreg[2:0]
Definition:
imu_message393.v:62
logger
imu_message393.v
Generated by
1.8.12