OpenCores
URL https://opencores.org/ocsvn/djpeg/djpeg/trunk

Subversion Repositories djpeg

[/] [djpeg/] [trunk/] [src/] [jpeg_dht.v] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 hidemi
//---------------------------------------------------------------------------
2 9 hidemi
// File Name    : jpeg_dht.v
3
// Module Name  : jpeg_dht
4
// Description  : DHT space
5
// Project      : JPEG Decoder
6
// Belong to    : 
7
// Author       : H.Ishihara
8
// E-Mail       : hidemi@sweetcafe.jp
9
// HomePage     : http://www.sweetcafe.jp/
10
// Date         : 2006/10/01
11
// Rev.         : 1.1
12 3 hidemi
//---------------------------------------------------------------------------
13 9 hidemi
// Rev. Date         Description
14 3 hidemi
//---------------------------------------------------------------------------
15
// 1.01 2006/10/01 1st Release
16
//---------------------------------------------------------------------------
17
`timescale 1ps / 1ps
18
 
19 9 hidemi
module jpeg_dht(
20
    rst,
21
    clk,
22 3 hidemi
 
23 9 hidemi
    DataInEnable,
24
    DataInColor,
25
    DataInCount,
26
    DataIn,
27 3 hidemi
 
28 9 hidemi
    ColorNumber,
29
    TableNumber,
30
    ZeroTable,
31
    WidhtTable
32
    );
33 3 hidemi
 
34 9 hidemi
    input           rst;
35
    input           clk;
36 3 hidemi
 
37 9 hidemi
    input           DataInEnable;
38
    input [1:0]     DataInColor;
39
    input [7:0]     DataInCount;
40
    input [7:0]     DataIn;
41 3 hidemi
 
42 9 hidemi
    input [1:0]     ColorNumber;
43
    input [7:0]     TableNumber;
44
    output [3:0]    ZeroTable;
45
    output [3:0]    WidhtTable;
46 3 hidemi
 
47 9 hidemi
    // RAM
48
    reg [7:0]       DHT_Ydc [0:15];
49
    reg [7:0]       DHT_Yac [0:255];
50
    reg [7:0]       DHT_Cdc [0:15];
51
    reg [7:0]       DHT_Cac [0:255];
52 3 hidemi
 
53 9 hidemi
    reg [7:0]       ReadDataYdc;
54
    reg [7:0]       ReadDataYac;
55
    reg [7:0]       ReadDataCdc;
56
    reg [7:0]       ReadDataCac;
57 3 hidemi
 
58 9 hidemi
    wire [7:0]      ReadData;
59
 
60
    // RAM
61
    always @(posedge clk) begin
62
        if(DataInEnable ==1'b1 & DataInColor ==2'b00) begin
63
            DHT_Ydc[DataInCount[3:0]] <= DataIn;
64
        end
65
        if(DataInEnable ==1'b1 & DataInColor ==2'b01) begin
66
            DHT_Yac[DataInCount] <= DataIn;
67
        end
68
        if(DataInEnable ==1'b1 & DataInColor ==2'b10) begin
69
            DHT_Cdc[DataInCount[3:0]] <= DataIn;
70
        end
71
        if(DataInEnable ==1'b1 & DataInColor ==2'b11) begin
72
            DHT_Cac[DataInCount] <= DataIn;
73
        end
74
    end
75 3 hidemi
 
76 9 hidemi
    always @(posedge clk) begin
77
        ReadDataYdc <= DHT_Ydc[TableNumber[3:0]];
78
        ReadDataYac <= DHT_Yac[TableNumber];
79
        ReadDataCdc <= DHT_Cdc[TableNumber[3:0]];
80
        ReadDataCac <= DHT_Cac[TableNumber];
81
    end
82
 
83
    // Selector
84
    function [7:0] ReadDataSel;
85
        input [1:0]    ColorNumber;
86
        input [7:0]    ReadDataYdc;
87
        input [7:0]    ReadDataYac;
88
        input [7:0]    ReadDataCdc;
89
        input [7:0]    ReadDataCac;
90
        begin
91
            case (ColorNumber)
92
            2'b00: ReadDataSel = ReadDataYdc;
93
            2'b01: ReadDataSel = ReadDataYac;
94
            2'b10: ReadDataSel = ReadDataCdc;
95
            2'b11: ReadDataSel = ReadDataCac;
96
            endcase
97
        end
98
    endfunction
99
 
100
    assign ReadData = ReadDataSel(ColorNumber, ReadDataYdc, ReadDataYac, ReadDataCdc, ReadDataCac);
101
 
102
    assign ZeroTable  = ReadData[7:4];
103
    assign WidhtTable = ReadData[3:0];
104
 
105
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.