📄 dctu.v
字号:
///////////////////////////////////////////////////////////////////////// //////// Discrete Cosine Transform Unit //////// //////// Author: Richard Herveille //////// richard@asics.ws //////// www.asics.ws //////// ///////////////////////////////////////////////////////////////////////////// //////// Copyright (C) 2001 Richard Herveille //////// richard@asics.ws //////// //////// This source file may be used and distributed without //////// restriction provided that this copyright statement is not //////// removed from the file and that any derivative work contains //////// the original copyright notice and the associated disclaimer.//////// //////// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY //////// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED //////// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS //////// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR //////// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //////// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES //////// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE //////// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR //////// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF //////// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //////// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT //////// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //////// POSSIBILITY OF SUCH DAMAGE. //////// /////////////////////////////////////////////////////////////////////////// CVS Log//// $Id: dctu.v,v 1.3 2002/10/31 12:50:03 rherveille Exp $//// $Date: 2002/10/31 12:50:03 $// $Revision: 1.3 $// $Author: rherveille $// $Locker: $// $State: Exp $//// Change History:// $Log: dctu.v,v $// Revision 1.3 2002/10/31 12:50:03 rherveille// *** empty log message ***//// Revision 1.2 2002/10/23 09:06:59 rherveille// Improved many files.// Fixed some bugs in Run-Length-Encoder.// Removed dependency on ud_cnt and ro_cnt.// Started (Motion)JPEG hardware encoder project.////synopsys translate_off//`include "timescale.v"//synopsys translate_onmodule dctu(clk, ena, ddgo, x, y, ddin, dout); parameter coef_width = 16; parameter di_width = 8; parameter [2:0] v = 0; parameter [2:0] u = 0; // // inputs & outputs // input clk; input ena; input ddgo; // double delayed go signal input [2:0] x, y; input [di_width:1] ddin; // delayed data input output [11:0] dout; // // variables // reg [ 31:0] coef; wire [coef_width +10:0] result; //`include "dct_cos_table" function [31:0] dct_cos_table; // // inputs & outputs // input [2:0] x,y,u,v; // table entry begin // // Table definition // // Function: cos( (2x +1) * u * pi)/16) * cos( (2y +1) * v * pi)/16) // // select bits: // 11:9 - V // 8:6 - U // 5:3 - Y // 2:0 - X case ( {v,u} ) // synopsys full_case parallel_case 6'h00: case ( {y,x} ) // synopsys full_case parallel_case 6'h00: dct_cos_table = 32'h20000000; // = +0.500000 6'h01: dct_cos_table = 32'h20000000; // = +0.500000 6'h02: dct_cos_table = 32'h20000000; // = +0.500000 6'h03: dct_cos_table = 32'h20000000; // = +0.500000 6'h04: dct_cos_table = 32'h20000000; // = +0.500000 6'h05: dct_cos_table = 32'h20000000; // = +0.500000 6'h06: dct_cos_table = 32'h20000000; // = +0.500000 6'h07: dct_cos_table = 32'h20000000; // = +0.500000 6'h08: dct_cos_table = 32'h20000000; // = +0.500000 6'h09: dct_cos_table = 32'h20000000; // = +0.500000 6'h0a: dct_cos_table = 32'h20000000; // = +0.500000 6'h0b: dct_cos_table = 32'h20000000; // = +0.500000 6'h0c: dct_cos_table = 32'h20000000; // = +0.500000 6'h0d: dct_cos_table = 32'h20000000; // = +0.500000 6'h0e: dct_cos_table = 32'h20000000; // = +0.500000 6'h0f: dct_cos_table = 32'h20000000; // = +0.500000 6'h10: dct_cos_table = 32'h20000000; // = +0.500000 6'h11: dct_cos_table = 32'h20000000; // = +0.500000 6'h12: dct_cos_table = 32'h20000000; // = +0.500000 6'h13: dct_cos_table = 32'h20000000; // = +0.500000 6'h14: dct_cos_table = 32'h20000000; // = +0.500000 6'h15: dct_cos_table = 32'h20000000; // = +0.500000 6'h16: dct_cos_table = 32'h20000000; // = +0.500000 6'h17: dct_cos_table = 32'h20000000; // = +0.500000 6'h18: dct_cos_table = 32'h20000000; // = +0.500000 6'h19: dct_cos_table = 32'h20000000; // = +0.500000 6'h1a: dct_cos_table = 32'h20000000; // = +0.500000 6'h1b: dct_cos_table = 32'h20000000; // = +0.500000 6'h1c: dct_cos_table = 32'h20000000; // = +0.500000 6'h1d: dct_cos_table = 32'h20000000; // = +0.500000 6'h1e: dct_cos_table = 32'h20000000; // = +0.500000 6'h1f: dct_cos_table = 32'h20000000; // = +0.500000 6'h20: dct_cos_table = 32'h20000000; // = +0.500000 6'h21: dct_cos_table = 32'h20000000; // = +0.500000 6'h22: dct_cos_table = 32'h20000000; // = +0.500000 6'h23: dct_cos_table = 32'h20000000; // = +0.500000 6'h24: dct_cos_table = 32'h20000000; // = +0.500000 6'h25: dct_cos_table = 32'h20000000; // = +0.500000 6'h26: dct_cos_table = 32'h20000000; // = +0.500000 6'h27: dct_cos_table = 32'h20000000; // = +0.500000 6'h28: dct_cos_table = 32'h20000000; // = +0.500000 6'h29: dct_cos_table = 32'h20000000; // = +0.500000 6'h2a: dct_cos_table = 32'h20000000; // = +0.500000 6'h2b: dct_cos_table = 32'h20000000; // = +0.500000 6'h2c: dct_cos_table = 32'h20000000; // = +0.500000 6'h2d: dct_cos_table = 32'h20000000; // = +0.500000 6'h2e: dct_cos_table = 32'h20000000; // = +0.500000 6'h2f: dct_cos_table = 32'h20000000; // = +0.500000 6'h30: dct_cos_table = 32'h20000000; // = +0.500000 6'h31: dct_cos_table = 32'h20000000; // = +0.500000 6'h32: dct_cos_table = 32'h20000000; // = +0.500000 6'h33: dct_cos_table = 32'h20000000; // = +0.500000 6'h34: dct_cos_table = 32'h20000000; // = +0.500000 6'h35: dct_cos_table = 32'h20000000; // = +0.500000 6'h36: dct_cos_table = 32'h20000000; // = +0.500000 6'h37: dct_cos_table = 32'h20000000; // = +0.500000 6'h38: dct_cos_table = 32'h20000000; // = +0.500000 6'h39: dct_cos_table = 32'h20000000; // = +0.500000 6'h3a: dct_cos_table = 32'h20000000; // = +0.500000 6'h3b: dct_cos_table = 32'h20000000; // = +0.500000 6'h3c: dct_cos_table = 32'h20000000; // = +0.500000 6'h3d: dct_cos_table = 32'h20000000; // = +0.500000 6'h3e: dct_cos_table = 32'h20000000; // = +0.500000 6'h3f: dct_cos_table = 32'h20000000; // = +0.500000 endcase 6'h01: case ( {y,x} ) // synopsys full_case parallel_case 6'h00: dct_cos_table = 32'h2c62a162; // = +0.693520 6'h01: dct_cos_table = 32'h25a0c5df; // = +0.587938 6'h02: dct_cos_table = 32'h192469c0; // = +0.392847 6'h03: dct_cos_table = 32'h08d42aef; // = +0.137950 6'h04: dct_cos_table = 32'hf72bd511; // = -0.137950 6'h05: dct_cos_table = 32'he6db9640; // = -0.392847 6'h06: dct_cos_table = 32'hda5f3a21; // = -0.587938 6'h07: dct_cos_table = 32'hd39d5e9e; // = -0.693520 6'h08: dct_cos_table = 32'h2c62a162; // = +0.693520 6'h09: dct_cos_table = 32'h25a0c5df; // = +0.587938 6'h0a: dct_cos_table = 32'h192469c0; // = +0.392847 6'h0b: dct_cos_table = 32'h08d42aef; // = +0.137950 6'h0c: dct_cos_table = 32'hf72bd511; // = -0.137950 6'h0d: dct_cos_table = 32'he6db9640; // = -0.392847 6'h0e: dct_cos_table = 32'hda5f3a21; // = -0.587938 6'h0f: dct_cos_table = 32'hd39d5e9e; // = -0.693520 6'h10: dct_cos_table = 32'h2c62a162; // = +0.693520 6'h11: dct_cos_table = 32'h25a0c5df; // = +0.587938 6'h12: dct_cos_table = 32'h192469c0; // = +0.392847 6'h13: dct_cos_table = 32'h08d42aef; // = +0.137950 6'h14: dct_cos_table = 32'hf72bd511; // = -0.137950 6'h15: dct_cos_table = 32'he6db9640; // = -0.392847 6'h16: dct_cos_table = 32'hda5f3a21; // = -0.587938 6'h17: dct_cos_table = 32'hd39d5e9e; // = -0.693520 6'h18: dct_cos_table = 32'h2c62a162; // = +0.693520 6'h19: dct_cos_table = 32'h25a0c5df; // = +0.587938 6'h1a: dct_cos_table = 32'h192469c0; // = +0.392847 6'h1b: dct_cos_table = 32'h08d42aef; // = +0.137950 6'h1c: dct_cos_table = 32'hf72bd511; // = -0.137950 6'h1d: dct_cos_table = 32'he6db9640; // = -0.392847 6'h1e: dct_cos_table = 32'hda5f3a21; // = -0.587938 6'h1f: dct_cos_table = 32'hd39d5e9e; // = -0.693520 6'h20: dct_cos_table = 32'h2c62a162; // = +0.693520 6'h21: dct_cos_table = 32'h25a0c5df; // = +0.587938 6'h22: dct_cos_table = 32'h192469c0; // = +0.392847 6'h23: dct_cos_table = 32'h08d42aef; // = +0.137950 6'h24: dct_cos_table = 32'hf72bd511; // = -0.137950 6'h25: dct_cos_table = 32'he6db9640; // = -0.392847 6'h26: dct_cos_table = 32'hda5f3a21; // = -0.587938 6'h27: dct_cos_table = 32'hd39d5e9e; // = -0.693520 6'h28: dct_cos_table = 32'h2c62a162; // = +0.693520 6'h29: dct_cos_table = 32'h25a0c5df; // = +0.587938 6'h2a: dct_cos_table = 32'h192469c0; // = +0.392847 6'h2b: dct_cos_table = 32'h08d42aef; // = +0.137950 6'h2c: dct_cos_table = 32'hf72bd511; // = -0.137950 6'h2d: dct_cos_table = 32'he6db9640; // = -0.392847 6'h2e: dct_cos_table = 32'hda5f3a21; // = -0.587938 6'h2f: dct_cos_table = 32'hd39d5e9e; // = -0.693520 6'h30: dct_cos_table = 32'h2c62a162; // = +0.693520 6'h31: dct_cos_table = 32'h25a0c5df; // = +0.587938 6'h32: dct_cos_table = 32'h192469c0; // = +0.392847 6'h33: dct_cos_table = 32'h08d42aef; // = +0.137950 6'h34: dct_cos_table = 32'hf72bd511; // = -0.137950 6'h35: dct_cos_table = 32'he6db9640; // = -0.392847 6'h36: dct_cos_table = 32'hda5f3a21; // = -0.587938 6'h37: dct_cos_table = 32'hd39d5e9e; // = -0.693520 6'h38: dct_cos_table = 32'h2c62a162; // = +0.693520 6'h39: dct_cos_table = 32'h25a0c5df; // = +0.587938 6'h3a: dct_cos_table = 32'h192469c0; // = +0.392847 6'h3b: dct_cos_table = 32'h08d42aef; // = +0.137950
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -