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

Subversion Repositories djpeg

[/] [djpeg/] [trunk/] [src/] [jpeg_regdata.v] - Diff between revs 3 and 5

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 3 Rev 5
Line 5... Line 5...
// Project     : JPEG Decoder
// Project     : JPEG Decoder
// Belong to   : 
// Belong to   : 
// Author      : H.Ishihara
// Author      : H.Ishihara
// E-Mail      : hidemi@sweetcafe.jp
// E-Mail      : hidemi@sweetcafe.jp
// HomePage    : http://www.sweetcafe.jp/
// HomePage    : http://www.sweetcafe.jp/
// Date        : 2006/10/01
// Date                 : 2007/04/11
// Rev.        : 1.1
// Rev.                 : 1.03
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Rev. Date       Description
// Rev. Date       Description
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 1.01 2006/10/01 1st Release
// 1.01 2006/10/01 1st Release
// 1.02 2006/10/04 Remove a RegEnd register.
// 1.02 2006/10/04 Remove a RegEnd register.
//                 When reset, clear on OutEnable,PreEnable,DataOut registers.
//                 When reset, clear on OutEnable,PreEnable,DataOut registers.
//                 Remove some comments.
//                 Remove some comments.
 
// 1.03 2007/04/11 Don't OutEnable, ImageEnable == 1 and DataOut == 0xFFD9XXXX
 
//                 Stop ReadEnable with DataEnd(after 0xFFD9 of ImageData)
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// $Id: 
// $Id: 
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
`timescale 1ps / 1ps
`timescale 1ps / 1ps
 
 
module jpeg_regdata
module jpeg_regdata(
  (
 
   rst,
   rst,
   clk,
   clk,
 
 
   // Read Data
   // Read Data
   DataInStart,
 
   DataIn,       // 
   DataIn,       // 
   DataInEnable, // Data Enable
   DataInEnable, // Data Enable
   DataInRead,   // Data Read
   DataInRead,   // Data Read
 
 
   // DataOut
   // DataOut
   DataOut,       // Data Out
   DataOut,       // Data Out
   DataOutEnable, // Data Out Enable
   DataOutEnable, // Data Out Enable
   DataOutEnd,    // Data Out End
 
 
 
   // 
   // 
   ImageEnable,
   ImageEnable,
 
        ProcessIdle,
 
 
   // UseData
   // UseData
   UseBit,   // Used data bit
   UseBit,   // Used data bit
   UseWidth, // Used data bit width
   UseWidth, // Used data bit width
   UseByte,  // Used data byte
   UseByte,  // Used data byte
Line 48... Line 48...
   );
   );
 
 
   input         rst;
   input         rst;
   input         clk;
   input         clk;
 
 
   input         DataInStart;
 
   input [31:0]  DataIn;
   input [31:0]  DataIn;
   input         DataInEnable;
   input         DataInEnable;
   output        DataInRead;
   output        DataInRead;
 
 
   output [31:0] DataOut;
   output [31:0] DataOut;
   output        DataOutEnable;
   output        DataOutEnable;
   output        DataOutEnd;
 
 
 
   input         ImageEnable;
   input         ImageEnable;
 
        input                   ProcessIdle;
 
 
   input         UseBit;
   input         UseBit;
   input [6:0]   UseWidth;
   input [6:0]   UseWidth;
   input         UseByte;
   input         UseByte;
   input         UseWord;
   input         UseWord;
 
 
   wire          RegValid;
   wire          RegValid;
   reg [95:0]    RegData;
   reg [95:0]    RegData;
   reg [7:0]     RegWidth;
   reg [7:0]     RegWidth;
 
 
 
        reg                             DataEnd;
 
 
   assign        RegValid   = RegWidth > 64;
   assign        RegValid   = RegWidth > 64;
   assign        DataInRead = RegValid == 1'b0 & DataInEnable == 1'b1;
   assign        DataInRead = RegValid == 1'b0 & DataInEnable == 1'b1;
 
 
   always @(posedge clk or negedge rst) begin
   always @(posedge clk or negedge rst) begin
      if(!rst) begin
      if(!rst) begin
         RegData  <= 96'd0;
         RegData  <= 96'd0;
         RegWidth <= 8'h00;
         RegWidth <= 8'h00;
      end else begin
      end else begin
         if(DataInStart == 1'b1) begin
                        if(RegValid == 1'b0 & (DataInEnable == 1'b1 | DataEnd == 1'b1)) begin
            RegData  <= 96'd0;
 
            RegWidth <= 8'h00;
 
         end else if(RegValid == 1'b0 & DataInEnable == 1'b1) begin
 
            if(ImageEnable == 1'b1) begin
            if(ImageEnable == 1'b1) begin
               if(RegData[39: 8] == 32'hFF00FF00) begin
               if(RegData[39: 8] == 32'hFF00FF00) begin
                  RegWidth       <= RegWidth + 16;
                  RegWidth       <= RegWidth + 16;
                  RegData[95:64] <= {8'h00,RegData[71:48]};
                  RegData[95:64] <= {8'h00,RegData[71:48]};
                  RegData[63:32] <= {RegData[47:40],16'hFFFF,RegData[7:0]};
                  RegData[63:32] <= {RegData[47:40],16'hFFFF,RegData[7:0]};
Line 115... Line 113...
               end else begin
               end else begin
                  RegWidth       <= RegWidth + 32;
                  RegWidth       <= RegWidth + 32;
                  RegData[95:64] <= RegData[63:32];
                  RegData[95:64] <= RegData[63:32];
                  RegData[63:32] <= RegData[31:0];
                  RegData[63:32] <= RegData[31:0];
               end
               end
            end else begin // if (ImageEnable == 1'b1)
                                end else begin
               RegWidth       <= RegWidth + 32;
               RegWidth       <= RegWidth + 32;
               RegData[95:64] <= RegData[63:32];
               RegData[95:64] <= RegData[63:32];
               RegData[63:32] <= RegData[31:0];
               RegData[63:32] <= RegData[31:0];
            end // else: !if(ImageEnable == 1'b1)
                                end
            RegData[31: 0] <= {DataIn[7:0],DataIn[15:8],DataIn[23:16],DataIn[31:24]};
            RegData[31: 0] <= {DataIn[7:0],DataIn[15:8],DataIn[23:16],DataIn[31:24]};
         end else if(UseBit == 1'b1) begin // if (RegValid == 1'b0 & DataInEnable == 1'b1)
                        end else if(UseBit == 1'b1) begin
            RegWidth <= RegWidth - UseWidth;
            RegWidth <= RegWidth - UseWidth;
         end else if(UseByte == 1'b1) begin
         end else if(UseByte == 1'b1) begin
            RegWidth <= RegWidth - 8;
            RegWidth <= RegWidth - 8;
         end else if(UseWord == 1'b1) begin
         end else if(UseWord == 1'b1) begin
            RegWidth <= RegWidth - 16;
            RegWidth <= RegWidth - 16;
         end
         end
      end // else: !if(!rst)
                end
   end // always @ (posedge clk or negedge rst)
        end
 
 
   assign DataOutEnd = (//RegData[39:24] == 16'hFFD9 |
        always @(posedge clk or negedge rst) begin
                        RegData[31:16] == 16'hFFD9 |
                if(!rst) begin
                        RegData[23: 8] == 16'hFFD9 |
                        DataEnd <= 1'b0;
                        RegData[15: 0] == 16'hFFD9
                end else begin
                        );
                        if(ProcessIdle) begin
 
                                DataEnd <= 1'b0;
 
                        end else if(ImageEnable == 1'b1 & (RegData[39:24] == 16'hFFD9 | RegData[31:16] == 16'hFFD9 | RegData[23: 8] == 16'hFFD9 | RegData[15: 0] == 16'hFFD9)) begin
 
                                DataEnd <= 1'b1;
 
                        end
 
                end
 
        end
 
 
   function [31:0] SliceData;
   function [31:0] SliceData;
      input [95:0] RegData;
      input [95:0] RegData;
      input [7:0]  RegWidth;
      input [7:0]  RegWidth;
 
 
Line 175... Line 179...
        8'd93: SliceData = RegData[92:61];
        8'd93: SliceData = RegData[92:61];
        8'd94: SliceData = RegData[93:62];
        8'd94: SliceData = RegData[93:62];
        8'd95: SliceData = RegData[94:63];
        8'd95: SliceData = RegData[94:63];
        8'd96: SliceData = RegData[95:64];
        8'd96: SliceData = RegData[95:64];
        default: SliceData = 32'h00000000;
        default: SliceData = 32'h00000000;
      endcase // case(RegWidth)
                endcase
   endfunction // SliceData
        endfunction
 
 
   reg             OutEnable;
   reg             OutEnable;
   reg             PreEnable;
   reg             PreEnable;
 
 
   reg [31:0]       DataOut;
   reg [31:0]       DataOut;
Line 197... Line 201...
      end
      end
   end
   end
 
 
   assign DataOutEnable = (PreEnable == 1'b0)?OutEnable:1'b0;
   assign DataOutEnable = (PreEnable == 1'b0)?OutEnable:1'b0;
 
 
endmodule // jpeg_regdata
endmodule
 
 
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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