LogIn E-mail
¼³°èÀ̾߱â
YCbCr2RGB.v
# 79 JMJS    10.5.12 15:18

`timescale 1ns/10ps

module YCbCr2RGB (        Red,Green,Blue,oDVAL,
                                        iY,iCb,iCr,iDVAL,
                                        iRESET,iCLK);
//        Input
input [7:0] iY,iCb,iCr;
input iDVAL,iRESET,iCLK;
//        Output
output [9:0] Red,Green,Blue;
output reg        oDVAL;
//        Internal Registers/Wires
reg [9:0] oRed,oGreen,oBlue;
reg        [3:0] oDVAL_d;
reg [11:0] X_OUT,Y_OUT,Z_OUT;
wire [27:0] X,Y,Z;

assign        Red  =        oRed;
assign        Green=        oGreen;
assign        Blue =        oBlue;

always@(posedge iCLK)
begin
        if(iRESET)
        begin
                oDVAL<=0;
                oDVAL_d<=0;
                oRed<=0;
                oGreen<=0;
                oBlue<=0;
        end
        else
        begin
                // Red
                if(X_OUT[11])
                oRed<=0;
                else if(X_OUT[10:0]>1023)
                oRed<=1023;
                else
                oRed<=X_OUT[9:0];
                // Green
                if(Y_OUT[11])
                oGreen<=0;
                else if(Y_OUT[10:0]>1023)
                oGreen<=1023;
                else
                oGreen<=Y_OUT[9:0];
                // Blue
                if(Z_OUT[11])
                oBlue<=0;
                else if(Z_OUT[10:0]>1023)
                oBlue<=1023;
                else
                oBlue<=Z_OUT[9:0];
                // Control
                {oDVAL,oDVAL_d}<={oDVAL_d,iDVAL};
        end
end

always@(posedge iCLK)
begin
        if(iRESET)
        begin
                X_OUT<=0;
                Y_OUT<=0;
                Z_OUT<=0;
        end
        else
        begin
                X_OUT<=( ( X - 105555 ) >>7 ) + 1;
                Y_OUT<=( ( Y + 64218  ) >>7 ) + 1;
                Z_OUT<=( ( Z - 131072 ) >>7 ) + 1;                        
        end
end

//        Y                551,                0,                        756
MAC_3 u0(        iY,                        iCb,                iCr,
                        18'h00227,        18'h00000,        18'h002F4,
                        X,                iRESET,                iCLK);
//        Cb                551,                -186,                -385
MAC_3 u1(        iY,                        iCb,                iCr,
                        18'h00227,        18'h3FF46,        18'h3FE7F,
                        Y,                iRESET,                iCLK);
//        Cr                551,                955,                0
MAC_3 u2(        iY,                        iCb,                iCr,
                        18'h00227,        18'h003BB,        18'h00000,
                        Z,                iRESET,                iCLK);

endmodule

÷ºÎÆÄÀÏ: YCbCr2RGB.v
°Ô½Ã¹°: 96 °Ç, ÇöÀç: 1 / 1 ÂÊ
¹øÈ£ Á¦       ¸ñ ÀÛ¼ºÀÚ µî·ÏÀÏ ¹æ¹®
98  interface JMJS 25.1.20 168
97  test plusargs value plusargs JMJS 24.9.5 236
96  color text JMJS 24.7.13 240
95  draw_hexa.v JMJS 10.6.17 2442
94  jmjsxram3.v JMJS 10.4.9 2169
93  Verilog document JMJS 11.1.24 2770
92  [verilog]o=(c1)? (c2)? 0:1 : (c3)? 2:3; JMJS 09.3.31 2361
91  [verilog]forever, repeat, strobe, realtime, ... JMJS 09.7.6 3780
90  gtkwave PC version JMJS 09.3.30 2106
89  ncsim option example JMJS 08.12.1 4500
88  [¿µ»ó]keywords for web search JMJS 08.12.1 2132
87  [Verilog]fdisplay fopen fscanf JMJS 11.1.24 6446
86  ncverilog option example JMJS 10.6.8 7953
85  [Verilog]Latch example JMJS 08.12.1 2717
84  Pad verilog example JMJS 01.3.16 4645
83  [ModelSim] vector JMJS 01.3.16 2330
82  RTL Code ºÐ¼®¼ø¼­ JMJS 09.4.29 2619
81  [temp]PIPE JMJS 08.10.2 1978
80  [temp]always-forever ¹«ÇÑ·çÇÁ JMJS 08.10.2 2056
79  YCbCr2RGB.v JMJS 10.5.12 2284
78  [VHDL]rom64x8 JMJS 09.3.27 1872
77  [function]vector_compare JMJS 02.6.19 1823
76  [function]vector2integer JMJS 02.6.19 1908
75  [VHDL]ram8x4x8 JMJS 08.12.1 1787
74  [¿¹]shift JMJS 02.6.19 2145
73  test JMJS 09.7.20 1936
72  test JMJS 09.7.20 1715
71  test JMJS 09.7.20 1648
70  test JMJS 09.7.20 1742
69  test JMJS 09.7.20 1790
68  test JMJS 09.7.20 1722
67  test JMJS 09.7.20 1638
66  test JMJS 09.7.20 1613
65  test JMJS 09.7.20 1714
64  test JMJS 09.7.20 1942
63  test JMJS 09.7.20 1961
62  test JMJS 09.7.20 1866
61  VHDLÀÇ ¿¬»êÀÚ ¿ì¼±¼øÀ§ JMJS 09.7.20 3673
60  test JMJS 09.7.20 1649
59  test JMJS 09.7.20 1744
58  test JMJS 09.7.20 1714
57  test JMJS 09.7.20 1671
56  test JMJS 09.7.20 1707
55  verilog Çаú »ùÇð­ÀÇ JMJS 16.5.30 2318
54  [verilog]create_generated_clock JMJS 15.4.28 2309
53  [Verilog]JDIFF JMJS 14.7.4 1574
52  [verilog]parameter definition JMJS 14.3.5 1839
51  [verilog]sformat fopen fscanf fwrite fclose JMJS 12.1.31 4800
50  Verilog File I/0,Verilog file handling JMJS 12.1.30 2573
49  Verdi JMJS 10.4.22 3279
48  draw hexa JMJS 10.4.9 1925
47  asfifo - Async FIFO JMJS 10.4.8 1767
46  VHDLÀ» ÀÌ¿ëÇÑ È¸·Î¼³°èÀÇ ÀåÁ¡ JMJS 02.3.14 3398
45  synplify batch JMJS 10.3.8 2500
44  ÀüÀڽðè Type A JMJS 08.11.28 2012
43  I2C Webpage JMJS 08.2.25 1865
42  PC¿¡¼­ °£´ÜÈ÷ Verilog ½ÇÇàÇØº¸±â (Icarus Verilog) JMJS 13.1.14 6023
41  [Verilog]vstring JMJS 17.9.27 2107
40  Riviera Simple Case JMJS 09.4.29 3237
39  [VHDL]DES Example JMJS 07.6.15 2994
38  [verilog]RAM example JMJS 09.6.5 2759
37  ROM example [VerilogHDL, RTL] JMJS 04.5.27 2036
36  Jamie's VHDL Handbook JMJS 08.11.28 2711
35  Dualport RAM example [VerilogHDL, RTL] JMJS 04.5.27 3339
34  RTL Job JMJS 09.4.29 2180
33  [VHDL]type example - package TYPES JMJS 06.2.2 1854
32  [verilog]`define `ifdef `elsif `else `endif ... JMJS 10.5.11 9383
30  [verilog]array_module JMJS 05.12.8 2320
29  [verilog-2001]generate JMJS 05.12.8 3407
28  protected JMJS 05.11.18 2077
27  design¿¡ latch°¡ ÀÖÀ¸¸é ¾ÈµÇ³ª¿ä? JMJS 09.7.20 2888
26  busÀÇ µ¥ÀÌŸ¸¦ °¢ bitº°·Î Ãâ·ÂÇÏ´Â ¹æ¹ýÀº? JMJS 04.11.9 1917
25  component¸¦ »ý¼ºÇؼ­ ´Ù¸¥ °÷¿¡¼­ È£ÃâÇÏ´Â ¹æ¹ý JMJS 04.11.4 2510
23  Array Of Array JMJS 04.8.16 2026
22  dumpfile, dumpvars JMJS 04.7.19 3628
21  Vending Machine Jamie 02.12.16 10101
20  Mini Vending Machine1 Jamie 02.12.10 6982
19  Mini Vending Machine Jamie 02.12.6 9838
18  Key Jamie 02.11.29 5003
17  Stop Watch Jamie 02.11.25 5698
16  Mealy Machine Jamie 02.8.29 6759
15  Moore Machine Jamie 02.8.29 17985
14  Up Down Counter Jamie 02.8.29 4093
13  Up Counter Jamie 02.8.29 2791
12  Edge Detecter Jamie 02.8.29 2997
11  Concept4 Jamie 02.8.28 2129
10  Concept3 Jamie 02.8.28 2091
9  Concept2_1 Jamie 02.8.28 1970
8  Concept2 Jamie 02.8.28 2063
7  Concept1 Jamie 02.8.26 2281
6  Tri State Buffer Jamie 02.8.26 3564
5  8x3 Encoder Jamie 02.8.28 4183
4  3x8 Decoder Jamie 02.8.28 3855
3  4bit Comparator Jamie 02.8.26 3233
2  °¡À§ ¹ÙÀ§ º¸ °ÔÀÓ Jamie 02.8.26 5573
1  Two Input Logic Jamie 02.8.26 2477
[1]