User`s manual

65 // in the sequence of pixels, it is looking.
66
67 // Once we determine where to start, the FSM goes through a normal
68 // sequence of SAV process_YCrCb EAV... repeat
69
70 // The data stream looks as follows
71 // SAV_FF | SAV_00 | SAV_00 | SAV_XY | Cb0 | Y0 | Cr1 | Y1 | Cb2 | Y2 | ... | EAV sequence
72 // There are two things we need to do:
73 // 1. Find the two SAV blocks (stands for Start Active Video perhaps?)
74 // 2. Decode the subsequent data
75
76 reg [4:0] current_state = 5’h00;
77 reg [9:0] y = 10’h000; // luminance
78 reg [9:0] cr = 10’h000; // chrominance
79 reg [9:0] cb = 10’h000; // more chrominance
80
81 assign state = current_state;
82
83 always @ (posedge clk)
84 begin
85 if (reset)
86 begin
87
88 end
89 else
90 begin
91 // these states don’t do much except allow us to know where we are in the stream.
92 // whenever the synchronization code is seen, go back to the sync_state before
93 // transitioning to the new state
94 case (current_state)
95 SYNC_1: current_state <= (tv_in_ycrcb == 10’h000) ? SYNC_2 : SYNC_1;
96 SYNC_2: current_state <= (tv_in_ycrcb == 10’h000) ? SYNC_3 : SYNC_1;
97 SYNC_3: current_state <= (tv_in_ycrcb == 10’h200) ? SAV_f1_cb0 :
98 (tv_in_ycrcb == 10’h274) ? EAV_f1 :
99 (tv_in_ycrcb == 10’h2ac) ? SAV_VBI_f1 :
100 (tv_in_ycrcb == 10’h2d8) ? EAV_VBI_f1 :
101 (tv_in_ycrcb == 10’h31c) ? SAV_f2_cb0 :
102 (tv_in_ycrcb == 10’h368) ? EAV_f2 :
103 (tv_in_ycrcb == 10’h3b0) ? SAV_VBI_f2 :
104 (tv_in_ycrcb == 10’h3c4) ? EAV_VBI_f2 : SYNC_1;
105
106 SAV_f1_cb0: current_state <= (tv_in_ycrcb == 10’h3ff) ? SYNC_1 : SAV_f1_y0;
107 SAV_f1_y0: current_state <= (tv_in_ycrcb == 10’h3ff) ? SYNC_1 : SAV_f1_cr1;
108 SAV_f1_cr1: current_state <= (tv_in_ycrcb == 10’h3ff) ? SYNC_1 : SAV_f1_y1;
109 SAV_f1_y1: current_state <= (tv_in_ycrcb == 10’h3ff) ? SYNC_1 : SAV_f1_cb0;
110
45