亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dct.v

?? Verilog code for 2D-DCT with detailed documentation.
?? V
?? 第 1 頁 / 共 3 頁
字號:

/**********************************************************************
** -----------------------------------------------------------------------------**
** dct.v
**
** 8x8 discrete Cosine Transform
**
**
**
**                  Author: Latha Pillai
**                  Senior Applications Engineer
**
**                  Video Applications
**                  Advanced Products Group
**                  Xilinx, Inc.
**
**                  Copyright (c) 2001 Xilinx, Inc.
**                  All rights reserved
**
**                  Date:   Feb. 10, 2002
**
**                  RESTRICTED RIGHTS LEGEND
**
**      This software has not been published by the author, and 
**      has been disclosed to others for the purpose of enhancing 
**      and promoting design productivity in Xilinx products.
**
**      Therefore use, duplication or disclosure, now and in the 
**      future should give consideration to the productivity 
**      enhancements afforded the user of this code by the author's 
**      efforts.  Thank you for using our products !
**
** Disclaimer:  THESE DESIGNS ARE PROVIDED "AS IS" WITH NO WARRANTY 
**              WHATSOEVER AND XILINX SPECIFICALLY DISCLAIMS ANY 
**              IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
**              A PARTICULAR PURPOSE, OR AGAINST INFRINGEMENT.
** Module: dct8x8 : 

** A 1D-DCT is implemented on the input pixels first. The output of this
** called  the intermediate value is stored in a RAM. The 2nd 1D-DCT operation 
** is done on this stored value to give the final 2D-DCT ouput dct_2d. The 
** inputs are 8 bits wide and the 2d-dct ouputs are 9 bits wide.
** 1st 1D section
** The input signals are taken one pixel at a time in the order x00 to x07,
** x10 to x07 and so on upto x77. These inputs are fed into a 8 bit shift
** register. The outputs of the 8 bit shift registers are registered by the 
** div8clk which is the CLK signal divided by 8. This will enable us to 
** register in 8 pixels (one row) at a time. The pixels are paired up in an 
** adder subtractor in the order xk0,xk7:xk1,xk6:xk2,xk5:xk3,xk4. The adder 
** subtractor is tied to CLK. For every clk, the adder/subtractor module 
** alternaltley chooses addtion and subtraction. This selection is done by
** the toggle flop. The ouput of the addsub is fed into a muliplier whose 
** other input is connected to stored values in registers which act as 
** memory. The ouput of the 4 mulipliers are added at every CLK in the 
** final adder. The ouput of the  adder z_out is the 1D-DCT values given 
** out in the order in which the inputs were read in.

** It takes 8 clks to read in the first set of inputs, 1 clk to register 
** inputs,1 clk to do add/sub, 1clk to get absolute value,
** 1 clk for multiplication, 2 clk for the final adder. total = 14 clks to get 
** the 1st z_out value. Every subsequent clk gives out the next z_out value.
** So to get all the 64 values we need  11+63=74 clks.
** Storage / RAM section
** The ouputs z_out of the adder are stored in RAMs. Two RAMs are used so 
** that data write can be continuous. The 1st valid input for the RAM1 is 
** available at the 15th clk. So the RAM1 enable is active after 15 clks. 
** After this the write operation continues for 64 clks . At the 65th clock, 
** since z_out is continuous, we get the next valid z_out_00. This 2nd set of
** valid 1D-DCT coefficients are written into RAM2 which is enabled at 15+64 
** clks. So at 65th clk, RAM1 goes into read mode for the next 64 clks and 
** RAM2 is in write mode. After this for every 64 clks, the read and write 
** switches between the 2 RAMS.
** 2nd 1D-DCT section
** After the 1st 79th clk when RAM1 is full, the 2nd 1d calculations can 
** start. The second 1D implementation is the same as the 1st 1D 
** implementation with the inputs now coming from either RAM1 or RAM2. Also,
** the inputs are read in one column at a time in the order z00 to z70, z10 to 
** z70 upto z77. The oupts from the adder in the 2nd section are the 2D-DCT 
** coeeficients.
***********************************************************************/

`timescale 1ns/1ps

module dct ( CLK, RST, xin,dct_2d,rdy_out);
output [11:0] dct_2d;
input CLK, RST;
input[7:0] xin; /* input */
output rdy_out;
wire[11:0] dct_2d;

/* constants */

reg[7:0] memory1a, memory2a, memory3a, memory4a;

/* 1D section */
/* The max value of a pixel after processing (to make their expected mean to zero)
is 127. If all the values in a row are 127, the max value of the product terms
would be (127*8)*(23170/256) and that of z_out_int would be (127*8)*23170/65536.
This value divided by 2raised to 16 is equivalent to ignoring the 16 lsb bits of the value */

reg[7:0] xa0_in, xa1_in, xa2_in, xa3_in, xa4_in, xa5_in, xa6_in, xa7_in;
reg[8:0] xa0_reg, xa1_reg, xa2_reg, xa3_reg, xa4_reg, xa5_reg, xa6_reg, xa7_reg;
reg[7:0] addsub1a_comp,addsub2a_comp,addsub3a_comp,addsub4a_comp;
reg[9:0] add_sub1a,add_sub2a,add_sub3a,add_sub4a;
reg save_sign1a, save_sign2a, save_sign3a, save_sign4a;
reg[18:0] p1a,p2a,p3a,p4a;
wire[35:0] p1a_all,p2a_all,p3a_all,p4a_all;
reg[1:0] i_wait;
reg toggleA;
reg[18:0] z_out_int1,z_out_int2;
reg[18:0] z_out_int;
wire[10:0] z_out_rnd;
wire[10:0] z_out;
integer indexi;

/* clks and counters */
reg[3:0] cntr12 ;
reg[3:0] cntr8;
reg[6:0] cntr79;
reg[6:0] wr_cntr,rd_cntr;
reg[6:0] cntr92;

/* memory section */
reg[10:0] data_out;
wire en_ram1,en_dct2d;
reg en_ram1reg,en_dct2d_reg;
reg[10:0] ram1_mem[63:0],ram2_mem[63:0]; // add the following to infer block RAM in synlpicity
                                         //    synthesis syn_ramstyle = "block_ram"  //shd be within /*..*/

/* 2D section */
wire[10:0] data_out_final;
reg[10:0] xb0_in, xb1_in, xb2_in, xb3_in, xb4_in, xb5_in, xb6_in, xb7_in;
reg[11:0] xb0_reg, xb1_reg, xb2_reg, xb3_reg, xb4_reg, xb5_reg, xb6_reg, xb7_reg;
reg[11:0] add_sub1b,add_sub2b,add_sub3b,add_sub4b;
reg[10:0] addsub1b_comp,addsub2b_comp,addsub3b_comp,addsub4b_comp;
reg save_sign1b, save_sign2b, save_sign3b, save_sign4b;
reg[19:0] p1b,p2b,p3b,p4b;
wire[35:0] p1b_all,p2b_all,p3b_all,p4b_all;
reg toggleB;
reg[19:0] dct2d_int1,dct2d_int2;
reg[19:0] dct_2d_int;
wire[11:0] dct_2d_rnd;


/*  1D-DCT BEGIN */

// store  1D-DCT constant coeeficient values for multipliers */

always @ (posedge RST or posedge CLK)
   begin
   if (RST)
       begin
       memory1a <= 8'd0; memory2a <= 8'd0; memory3a <= 8'd0; memory4a <= 8'd0;
       end
   else
       begin
	     case (indexi)
         0 : begin memory1a <= 8'd91; 
                   memory2a <= 8'd91; 
                   memory3a <= 8'd91; 
                   memory4a <= 8'd91;end
         1 : begin memory1a <= 8'd126; 
                   memory2a <= 8'd106;  
                   memory3a <= 8'd71;  
                   memory4a <= 8'd25;end
         2 : begin memory1a <= 8'd118; 
                   memory2a <= 8'd49;  
                   memory3a[7] <= 1'b1; memory3a[6:0] <= 7'd49;//-8'd49; 
                   memory4a[7] <= 1'b1; memory4a[6:0] <= 7'd118;// end -8'd118;end
                   end
         3 : begin memory1a <= 8'd106; 
                   memory2a[7] <= 1'b1; memory2a[6:0] <= 7'd25;//-8'd25;  
                   memory3a[7] <= 1'b1; memory3a[6:0] <= 7'd126;//-8'd126; 
                   memory4a[7] <= 1'b1; memory4a[6:0] <= 7'd71;end//-8'd71;end
         4 : begin memory1a <= 8'd91; 
                   memory2a[7] <= 1'b1; memory2a[6:0] <= 7'd91;//-8'd91; 
                   memory3a[7] <= 1'b1; memory3a[6:0] <= 7'd91;//-8'd91; 
                   memory4a <= 8'd91;end
         5 : begin memory1a <= 8'd71; 
                   memory2a[7] <= 1'b1; memory2a[6:0] <= 7'd126;//-8'd126; 
                   memory3a <= 8'd25;   
                   memory4a <= 8'd106;end
         6 : begin memory1a <= 8'd49; 
                   memory2a[7] <= 1'b1; memory2a[6:0] <= 7'd118;//-8'd118; 
                   memory3a <= 8'd118;  
                   memory4a[7] <= 1'b1; memory4a[6:0] <= 7'd49;end//-8'd49;end
         7 : begin memory1a <= 8'd25;  
                   memory2a[7] <= 1'b1; memory2a[6:0] <= 7'd71;//-8'd71; 
                   memory3a <= 8'd106;  
                   memory4a[7] <= 1'b1; memory4a[6:0] <= 7'd126;end//-8'd126;end
       endcase
      end
end


/* 8-bit input shifted 8 times thru a shift register*/
always @ (posedge CLK or posedge RST)
   begin
   if (RST)
       begin
       xa0_in <= 8'b0; xa1_in <= 8'b0; xa2_in <= 8'b0; xa3_in <= 8'b0;
       xa4_in <= 8'b0; xa5_in <= 8'b0; xa6_in <= 8'b0; xa7_in <= 8'b0;
       end
   else
       begin
       xa0_in <= xin; xa1_in <= xa0_in; xa2_in <= xa1_in; xa3_in <= xa2_in;
       xa4_in <= xa3_in; xa5_in <= xa4_in; xa6_in <= xa5_in; xa7_in <= xa6_in;
       end
   end

/* shifted inputs registered every 8th clk (using cntr8)*/

always @ (posedge CLK or posedge RST)
   begin
   if (RST)
       begin
       cntr8 <= 4'b0;
       end
   else if (cntr8 < 4'b1000)
       begin
       cntr8 <= cntr8 + 1;
       end
   else 
       begin
       cntr8 <= 4'b0001;
       end
   end

always @ (posedge CLK or posedge RST)
   begin
   if (RST)
       begin
       xa0_reg <= 9'b0; xa1_reg <= 9'b0; xa2_reg <= 9'b0; xa3_reg <= 9'b0;
       xa4_reg <= 9'b0; xa5_reg <= 9'b0; xa6_reg <= 9'b0; xa7_reg <= 9'b0;
       end
   else if (cntr8 == 4'b1000)
       begin 
       xa0_reg <= {xa0_in[7],xa0_in}; xa1_reg <= {xa1_in[7],xa1_in}; 
       xa2_reg <= {xa2_in[7],xa2_in}; xa3_reg <= {xa3_in[7],xa3_in};
       xa4_reg <= {xa4_in[7],xa4_in}; xa5_reg <= {xa5_in[7],xa5_in}; 
       xa6_reg <= {xa6_in[7],xa6_in}; xa7_reg <= {xa7_in[7],xa7_in};
       end
   else 
       begin
       end
   end

always @ (posedge CLK or posedge RST)
   begin
   if (RST)
       begin
       toggleA <= 1'b0;
       end
   else 
       begin 
       toggleA <= ~toggleA;
       end
   end


/* adder / subtractor block */

always @ (posedge CLK or posedge RST)
   begin
   if (RST)
       begin
       add_sub1a <= 10'b0; add_sub2a <= 10'b0; add_sub3a <= 10'b0; add_sub4a <= 10'b0;
       end
   else
       begin
       if (toggleA == 1'b1)
	         begin
           add_sub1a <= (xa7_reg + xa0_reg); 
           add_sub2a <= (xa6_reg + xa1_reg);
           add_sub3a <= (xa5_reg + xa2_reg); 
           add_sub4a <= (xa4_reg + xa3_reg);
           end
       else if (toggleA == 1'b0)
	         begin
	         add_sub1a <= (xa7_reg - xa0_reg); 
           add_sub2a <= (xa6_reg - xa1_reg);
           add_sub3a <= (xa5_reg - xa2_reg); 
           add_sub4a <= (xa4_reg - xa3_reg);
	         end
       end
   end

/* The above if else statement used to get the add_sub signals can also be implemented 
using the adsu16 library element as follows */

//ADSU8 adsu8_1 (.A(xa0_reg), .B(xa7_reg), .ADD(toggleA), .CI(1'b0), .S(add_sub1a_all), .OFL(add_sub1a_ofl), .CO(open));
//ADSU8 adsu8_2 (.A(xa1_reg), .B(xa6_reg), .ADD(toggleA), .CI(1'b0), .S(add_sub2a_all), .OFL(add_sub1a_ofl), .CO(open));
//ADSU8 adsu8_3 (.A(xa2_reg), .B(xa5_reg), .ADD(toggleA), .CI(1'b0), .S(add_sub3a_all), .OFL(add_sub1a_ofl), .CO(open));
//ADSU8 adsu8_4 (.A(xa3_reg), .B(xa4_reg), .ADD(toggleA), .CI(1'b0), .S(add_sub4a_all), .OFL(add_sub1a_ofl), .CO(open));
/* In addition, Coregen can be used to create adder/subtractor units specific to a particular
device. The coregen model is then instantiated in the design file. The verilog file from 
coregen can be used along with the design files for simulation and implementation. */

//add_sub adsu8_1 (.A(xa0_reg), .B(xa7_reg), .ADD(toggleA), .CLK(CLK), .Q(add_sub1a));
//add_sub adsu8_2 (.A(xa1_reg), .B(xa6_reg), .ADD(toggleA), .CLK(CLK), .Q(add_sub2a));
//add_sub adsu8_3 (.A(xa2_reg), .B(xa5_reg), .ADD(toggleA), .CLK(CLK), .Q(add_sub3a));
//add_sub adsu8_4 (.A(xa3_reg), .B(xa4_reg), .ADD(toggleA), .CLK(CLK), .Q(add_sub4a));

/* multiply the outputs of the add/sub block with the 8 sets of stored coefficients */
/* The inputs are shifted thru 8 registers in 8 clk cycles. The ouput of the shift
registers are registered at the 9th clk. The values are then added or subtracted at the 10th
clk. The first mutiplier output is obtained at the 11th clk. Memoryx[0] shd be accessed
at the 11th clk*/

/*wait state counter */

always @ (posedge RST or posedge CLK)
   begin
   if (RST)
       begin
       i_wait <= 2'b01;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合夜色一区| 日韩精品亚洲一区| www.欧美.com| 亚洲精选视频免费看| 91福利国产成人精品照片| 亚洲国产精品人人做人人爽| 9191国产精品| 国产在线播精品第三| 国产精品成人一区二区艾草 | 国产欧美日韩视频在线观看| 国产成a人亚洲精品| 亚洲欧洲av一区二区三区久久| 91丨porny丨国产| 亚洲第一精品在线| 欧美精品一区二区三区蜜臀 | 亚洲女爱视频在线| 欧美色综合影院| 美国精品在线观看| 国产精品电影一区二区三区| 欧美日韩大陆在线| 国产成人免费视频网站| 一区二区三区日韩精品| 欧美一区二区三区四区在线观看| 国产高清不卡一区二区| 一区二区三区免费网站| 日韩免费视频一区二区| 色综合天天综合给合国产| 日本最新不卡在线| 国产精品国产精品国产专区不蜜| 欧美高清视频在线高清观看mv色露露十八 | 日韩免费高清av| 99久久99久久精品国产片果冻| 91麻豆国产在线观看| 婷婷久久综合九色国产成人| 国产免费观看久久| 欧美一二三在线| 99r国产精品| 麻豆精品一区二区三区| 国产精品久久三区| 欧美成人r级一区二区三区| 97久久超碰精品国产| 久久99精品久久久久婷婷| 亚洲精品国产精品乱码不99| 久久综合五月天婷婷伊人| 欧美偷拍一区二区| 99久久精品国产导航| 久久精品国产亚洲a| 一区二区三区精品视频| 国产欧美一区二区三区网站| 日韩欧美亚洲国产精品字幕久久久| 色网综合在线观看| 成人免费高清在线观看| 久久丁香综合五月国产三级网站| 亚洲午夜电影在线观看| 日韩伦理电影网| 欧美韩国日本综合| 久久久99精品久久| 26uuu另类欧美| 91精品国产综合久久国产大片 | 成人黄色网址在线观看| 久久精品国产免费| 日韩精品一二三四| 午夜视频一区二区三区| 亚洲一区在线播放| 一区二区三区中文在线| 国产精品国产自产拍高清av| 国产午夜精品一区二区 | jlzzjlzz亚洲女人18| 国产成人亚洲综合a∨婷婷| 国产在线不卡一区| 国产一区二区三区黄视频| 久草中文综合在线| 麻豆极品一区二区三区| 蜜桃视频在线一区| 蓝色福利精品导航| 久久精品国产第一区二区三区| 日本伊人午夜精品| 欧美日本在线播放| 欧美日韩在线三区| 制服丝袜成人动漫| 欧美一区二区成人6969| 欧美videossexotv100| 26uuu久久天堂性欧美| 久久精品亚洲精品国产欧美| 国产欧美一区二区精品性色超碰| 亚洲国产成人午夜在线一区| 国产精品盗摄一区二区三区| 《视频一区视频二区| 一区二区三区精品| 日本亚洲三级在线| 国产精品一区二区三区99| 不卡欧美aaaaa| 色94色欧美sute亚洲线路二| 欧美欧美欧美欧美| 精品国产伦一区二区三区观看体验| 久久午夜羞羞影院免费观看| 中文字幕欧美日本乱码一线二线| 综合色天天鬼久久鬼色| 午夜视频在线观看一区| 精品无人码麻豆乱码1区2区 | 亚洲日本乱码在线观看| 亚洲高清免费视频| 精品一区二区三区免费播放| 成人黄色大片在线观看| 欧美性大战久久久久久久| 欧美大片日本大片免费观看| 久久久久高清精品| 一片黄亚洲嫩模| 久久精品国产精品青草| 99精品欧美一区| 91精品一区二区三区久久久久久| 久久久久久久久久久99999| 综合分类小说区另类春色亚洲小说欧美| 亚洲人成网站影音先锋播放| 美女视频免费一区| 91在线国内视频| 日韩女优视频免费观看| 亚洲欧美日本在线| 国模套图日韩精品一区二区| 91啪亚洲精品| 精品国产3级a| 亚洲自拍偷拍图区| 盗摄精品av一区二区三区| 欧美日韩精品一区二区三区| 国产精品丝袜在线| 男女男精品视频| 91麻豆福利精品推荐| 麻豆极品一区二区三区| 色偷偷成人一区二区三区91| 精品国产凹凸成av人网站| 一区二区三区在线高清| 国产九色sp调教91| 欧美一区二区免费| 亚洲国产综合人成综合网站| 懂色av一区二区三区免费观看| 在线综合视频播放| 亚洲宅男天堂在线观看无病毒| 丁香六月久久综合狠狠色| 欧美mv日韩mv国产网站app| 亚洲综合丝袜美腿| 91偷拍与自偷拍精品| 久久久亚洲精品一区二区三区| 日日噜噜夜夜狠狠视频欧美人 | 亚洲国产日韩av| 97精品视频在线观看自产线路二| 2021中文字幕一区亚洲| 人人狠狠综合久久亚洲| 欧美日韩国产首页在线观看| 18成人在线视频| 成人小视频在线观看| wwwwww.欧美系列| 久久91精品久久久久久秒播| 91精品国产综合久久久久久久久久| 亚洲精品美腿丝袜| 91在线免费看| 亚洲欧美激情一区二区| 99久久精品国产毛片| 中文字幕一区二区三区精华液 | 爽好久久久欧美精品| 欧美主播一区二区三区美女| 大胆欧美人体老妇| 国产午夜精品久久| 国产麻豆成人精品| 久久看人人爽人人| 国产精品亚洲一区二区三区妖精| 久久久久亚洲蜜桃| 国产成人日日夜夜| 国产精品视频第一区| 成人一区二区视频| 国产精品情趣视频| 99久久精品一区| 亚洲欧美日韩精品久久久久| 91九色02白丝porn| 亚洲自拍偷拍av| 欧美狂野另类xxxxoooo| 秋霞成人午夜伦在线观看| 欧美videofree性高清杂交| 国产在线看一区| 亚洲国产精品av| 色伊人久久综合中文字幕| 亚洲一区在线观看网站| 在线综合+亚洲+欧美中文字幕| 狂野欧美性猛交blacked| 久久久影院官网| 99久久综合狠狠综合久久| 亚洲免费成人av| 欧美老肥妇做.爰bbww| 激情久久五月天| 国产精品乱人伦中文| 日本电影欧美片| 日韩中文字幕不卡| 久久亚洲精品国产精品紫薇| a4yy欧美一区二区三区| 亚洲福利国产精品| 精品88久久久久88久久久| av亚洲精华国产精华精华| 亚洲高清免费一级二级三级| 精品对白一区国产伦| 91免费小视频| 免费不卡在线观看|