x393  1.0
FPGAcodeforElphelNC393camera
timestamp_to_parallel.v
Go to the documentation of this file.
1 
40 `timescale 1ns/1ps
41 
43  input clk, // clock that drives time counters
44  input pre_stb, // just before receiving sequence of 7 bytes
45  input [7:0] tdata, // byte-parallel timestamp data
46  output reg [31:0] sec, // time seconds
47  output reg [19:0] usec, // time microseconds
48  output done // got serial timetamp message, output is valid (1-cycle pulse)
49 );
50  reg [6:0] seq;
51  assign done = seq[6];
52  always @ (posedge clk) begin
53  seq <= {seq[5:0],pre_stb};
54  if (seq[0]) sec[ 7: 0] <= tdata;
55  if (seq[1]) sec[15: 8] <= tdata;
56  if (seq[2]) sec[23:16] <= tdata;
57  if (seq[3]) sec[31:24] <= tdata;
58  if (seq[4]) usec[ 7: 0] <= tdata;
59  if (seq[5]) usec[15: 8] <= tdata;
60  if (seq[6]) usec[19:16] <= tdata[3:0];
61  end
62 endmodule
63