User`s manual

35 begin
36 const1 = 10’b 0100101010; //1.164 = 01.00101010
37 const2 = 10’b 0110011000; //1.596 = 01.10011000
38 const3 = 10’b 0011010000; //0.813 = 00.11010000
39 const4 = 10’b 0001100100; //0.392 = 00.01100100
40 const5 = 10’b 1000000100; //2.017 = 10.00000100
41 end
42
43 always @ (posedge clk or posedge rst)
44 if (rst)
45 begin
46 Y_reg <= 0; Cr_reg <= 0; Cb_reg <= 0;
47 end
48 else
49 begin
50 Y_reg <= Y; Cr_reg <= Cr; Cb_reg <= Cb;
51 end
52
53 always @ (posedge clk or posedge rst)
54 if (rst)
55 begin
56 A_int <= 0; B1_int <= 0; B2_int <= 0; C_int <= 0; X_int <= 0;
57 end
58 else
59 begin
60 X_int <= (const1 * (Y_reg - ’d64)) ;
61 A_int <= (const2 * (Cr_reg - ’d512));
62 B1_int <= (const3 * (Cr_reg - ’d512));
63 B2_int <= (const4 * (Cb_reg - ’d512));
64 C_int <= (const5 * (Cb_reg - ’d512));
65 end
66
67 always @ (posedge clk or posedge rst)
68 if (rst)
69 begin
70 R_int <= 0; G_int <= 0; B_int <= 0;
71 end
72 else
73 begin
74 R_int <= X_int + A_int;
75 G_int <= X_int - B1_int - B2_int;
76 B_int <= X_int + C_int;
77 end
78
79
80
40