48 // parameter LOGGER_PAGE_IMU = 0, // 'h00..'h1f - overlaps with period/duration/halfperiod/config? (was so in x353) 51 parameter LOGGER_PAGE_IMU =
3,
// 'h60..'h7f - removing overlap with period/duration/halfperiod/config 71 parameter GPIO_N =
10 // number of GPIO bits to control 74 input mclk,
// system clock 75 input xclk,
// was in 353: half frequency (80 MHz nominal) 76 input mrst,
// @ posedge mclk - sync reset 77 input xrst,
// @ posedge xclk - sync reset 78 // programming interface 79 input [
7:
0]
cmd_ad,
// byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 80 input cmd_stb,
// strobe (with first byte) for the command a/d 81 output [
7:
0]
status_ad,
// status address/data - up to 5 bytes: A - {seq,status[1:0]} - status[2:9] - status[10:17] - status[18:25] 82 output status_rq,
// input request to send status downstream 83 input status_start,
// Acknowledge of the first status packet byte (address) 85 output ts_local_snap,
// @posedge xclk request to take a local time snapshot 86 input ts_local_stb,
// @posedge xclk one clock pulse before receiving a local TS data 87 input [
7:
0]
ts_local_data,
// @posedge xclk local timestamp data (s0,s1,s2,s3,u0,u1,u2,u3==0) 94 // byte-parallel timestamps from 4 sensors channels (in triggered mode all are the same, different only in free running mode) 95 // each may generate logger event, channel number encoded in bits 25:24 of the external microseconds 97 input ts_stb_chn0,
// @mclk 1 clock before ts_rcv_data is valid 98 input [
7:
0]
ts_data_chn0,
// @mclk byte-wide serialized timestamp message received or local 101 input [
7:
0]
ts_data_chn1,
// @mclk byte-wide serialized timestamp message received or local 104 input [
7:
0]
ts_data_chn2,
// @mclk byte-wide serialized timestamp message received or local 107 input [
7:
0]
ts_data_chn3,
// @mclk byte-wide serialized timestamp message received or local 110 // TODO: Convert to 32-bit? 111 output [
15:
0]
data_out,
// 16-bit data out to DMA1 (@posdge mclk) 113 // sample_counter, // could be DMA latency, safe to use sample_counter-1 117 wire [
23:
0]
sample_counter;
// TODO: read with status! could be DMA latency, safe to use sample_counter-1 122 wire mosi;
// to IMU, bit 2 in J9 123 wire miso;
// from IMU, bit 3 on J9 126 reg [
6:
0]
ctrl_addr=
7'h0;
// 0 - period, 1 - reserved, 2..31 - registers to log, >32 - gps parameters, >64 - odometer message 134 reg we_config_gps;
// bits 6:3, 7 - enable - {ext,invert, slot[1:0]} slot==0 - disable 135 reg we_config_msg;
// bits 12:8,13 - enable - {invert,extinp[3:0]} extinp[3:0]=='hf' - disable 136 reg we_config_syn;
// bit 14, 15 - enable - enable logging external timestamps 137 reg we_config_rst;
// bit 14, 15 - enable - enable logging external timestamps 147 reg [
15:
0]
bitHalfPeriod;
// serial gps speed - number of xclk pulses in half bit period 193 wire [
1:
0]
channel;
// currently logged channel number 195 wire ts_en;
// log timestamp (when false - data) 196 wire mux_data_valid;
// data valid from multiplexer (to xclk->mclk converter fifo) 198 reg mux_rdy_source;
// data ready multiplexed from 1of the 4 channels (to fill rest with zeros) 199 reg [
15:
0]
mux_data_final;
// data multiplexed between timestamps and channel data (or 0 if ~ready) 205 // reg [1:0] debug_reg; 246 // filter gps_pulse1sec 262 always @ (
posedge mclk)
begin // was negedge 316 16'h0);
// replace 16'h0 with some pattern to debug output 319 // generate strobes to copy configuration data from mclk to xclk domain 336 )
cmd_deser_32bit_i (
337 .
rst (
1'b0),
//rst), // input 351 )
status_generate_i (
352 .
rst (
1'b0),
// rst), // input 365 .
mclk (
mclk),
// system clock, negedge 366 .
xclk (
xclk),
// half frequency (80 MHz nominal) 367 .
we_ra (
we_imu),
// write enable for registers to log (@negedge mclk) 369 .
we_period (
we_period),
// write enable for IMU cycle period(@negedge mclk) 0 - disable, 1 - single, >1 - half bit periods 370 .
wa (
ctrl_addr[
4:
0]),
// write address for register (5 bits, @negedge mclk) 372 .
mosi (
mosi),
// to IMU, bit 2 in J9 373 .
miso (
miso),
// from IMU, bit 3 on J9 375 .
sda (
sda),
// sda, shared with i2c, bit 1 376 .
sda_en (
sda_en),
// enable sda output (when sda==0 and 1 cycle after sda 0->1) 377 .
scl (
scl),
// scl, shared with i2c, bit 0 378 .
scl_en (
scl_en),
// enable scl output (when scl==0 and 1 cycle after sda 0->1) 384 logs events from odometer (can be software triggered), includes 56-byte message written to the buffer 385 So it is possible to assert trig input (will request timestamp), write message by software, then 386 de-assert the trig input - message with the timestamp will be logged 387 fixed-length de-noise circuitry with latency 256*T(xclk) (~3usec) 390 .
mclk (
mclk),
// system clock, negedge 391 .
xclk (
xclk),
// half frequency (80 MHz nominal) 392 .
we (
we_message),
// write enable for registers to log (@negedge sclk), with lower data half 393 .
wa (
ctrl_addr[
3:
0]),
// write address for register (4 bits, @negedge sclk) 395 .
en (
enable_msg),
// enable module operation, if 0 - reset 401 /* logs frame synchronization data from other camera (same as frame sync) **/ 402 // ts_stb (mclk) -> trig) 404 // .rst (rst), // input global reset 405 .
mclk (
mclk),
// system clock, negedge 406 .
xclk (
xclk),
// half frequency (80 MHz nominal) 431 .
ra ({
channel[
1:
0],
timestamp_sel[
1:
0]}),
// input[3:0]read address (2 MSBs - channel number, 2 LSBs - usec_low, (usec_high ORed with channel <<24), sec_low, sec_high 436 .
xclk (
xclk),
// half frequency (80 MHz nominal) 440 .
ts_stb (
gps_ts_stb),
// strobe timestamp (start of message) (reset bit counters in nmea decoder) 443 .
ser_do (
ser_do),
// serial data out(@posedge xclk) LSB first! 444 .
ser_do_stb (
ser_do_stb),
// output data strobe (@posedge xclk), first cycle after ser_do becomes valid 457 .
mclk (
mclk),
// system clock, @posedge 459 .
we (
we_gps),
// registers write enable 467 .
ser_stb (
ser_do_stb),
// serial data strobe, single-cycle, first cycle after ser_di valid 475 // Logger handshakes timestamps through request/grant, so it is OK to make slow serial communication with RTC) 482 .
rdy (
channel_ready[
3:
0]),
// channels ready (leading edge - became ready, trailing - no more data, use zero) 486 .
ts_en (
ts_en),
// 1 - use timestamp, 0 - channel data (or 16'h0 if !ready) 487 .
dv (
mux_data_valid),
// output data valid (from registered mux - 2 stage - first selects data and ready, second ts/data/zero)
3535timestamp_selwire[1:0]
3423LOGGER_STATUS_MASK'h7ff
3531timestamp_request_longwire[3:0]
3499we_config_imu_xclkwire
3510config_debug_mclkreg[3:0]
3528gps_pulse1sec_singlereg
3429LOGGER_BIT_HALF_PERIOD2
i_we_bitHalfPeriod_xclk pulse_cross_clock
3533channel_nextwire[3:0]
[23:0] 3732sample_counter
3514enable_syn_mclkwire[3:0]
3498bitHalfPeriodreg[15:0]
3524timestamps_rdatawire[15:0]
3511bitHalfPeriod_mclkreg[15:0]
[ADDR_MASK2!=0?2:ADDR_MASK1!=0?1:0:0] 9935we
3505config_imu_mclkreg[1:0]
3421LOGGER_STATUS_REG_ADDR'h39
i_logger_arbiter logger_arbiter393
3529timestamp_requestwire[3:0]
3507config_msg_mclkreg[4:0]
status_generate_i status_generate
3506config_gps_mclkreg[3:0]
3526gps_pulse1sec_denoisereg[1:0]
3436LOGGER_CONF_MSG_BITS5
3504we_bitHalfPeriod_xclkwire
[DATA_WIDTH-1:0] 9934data
3501we_config_msg_xclkwire
3508config_syn_mclkreg[3:0]
3532channel_readywire[3:0]
3502we_config_rst_xclkwire
3500we_config_gps_xclkwire
3538mux_data_sourcereg[15:0]
3432LOGGER_CONF_IMU_BITS2
[ADDR_WIDTH-1:0] 9933addr
i_imu_message imu_message393
3530timestamp_acknwire[3:0]
i_imu_timestamps imu_timestamps393
3525gps_pulse1sec_dreg[2:0]
3434LOGGER_CONF_GPS_BITS4
3470sample_counterwire[23:0]
3540mux_data_finalreg[15:0]
3527gps_pulse1sec_denoise_countreg[7:0]
cmd_deser_32bit_i cmd_deser
i_imu_exttime imu_exttime393
i_nmea_decoder nmea_decoder393
[ALL_BITS-1:0] 10777status
i_buf_xclk_mclk16 buf_xclk_mclk16_393
3442LOGGER_CONF_DBG_BITS4
3503we_config_debug_xclkwire
3438LOGGER_CONF_SYN_BITS4