亚洲欧美第一页_禁久久精品乱码_粉嫩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;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人综合在线观看| 欧美一区二区三区在线看| 国产一区二区三区在线看麻豆| 五月婷婷另类国产| 亚洲成人av资源| 亚洲成人中文在线| 午夜成人免费电影| 日韩av不卡在线观看| 轻轻草成人在线| 久久精品免费看| 国产制服丝袜一区| 成人a级免费电影| 99久久精品情趣| 91成人看片片| 欧美精品在线一区二区三区| 337p亚洲精品色噜噜噜| 欧美一区二区网站| 337p日本欧洲亚洲大胆精品| 久久久精品免费免费| 国产欧美日本一区视频| 亚洲三级免费观看| 亚洲国产综合人成综合网站| 日韩高清不卡在线| 国产一区视频网站| 成人污视频在线观看| 97超碰欧美中文字幕| 日本高清不卡一区| 91精品国产色综合久久久蜜香臀| 久久综合色一综合色88| 国产精品麻豆99久久久久久| 亚洲女与黑人做爰| 日韩 欧美一区二区三区| 国产在线麻豆精品观看| 色综合天天在线| 7777精品伊人久久久大香线蕉| 精品毛片乱码1区2区3区| 欧美韩国日本不卡| 亚洲一区二区三区视频在线播放 | 亚洲欧美二区三区| 亚洲成av人影院| 久久99久久久久| 成人高清视频免费观看| 欧美日韩成人一区| 日本一区二区成人在线| 亚洲bt欧美bt精品| 国产成人在线视频播放| 91久久精品一区二区三区| 欧美videofree性高清杂交| 国产精品久久久一区麻豆最新章节| 亚洲最色的网站| 激情五月婷婷综合| 国产精品国模大尺度视频| 亚洲.国产.中文慕字在线| 国产黑丝在线一区二区三区| 欧美无砖砖区免费| 国产欧美va欧美不卡在线| 午夜婷婷国产麻豆精品| 北条麻妃一区二区三区| 91麻豆精品国产91久久久久| 日韩一区中文字幕| 国产一区二区三区日韩| 欧美系列一区二区| 国产精品久久久久久久久免费相片| 五月婷婷欧美视频| 91在线观看美女| 久久久久久久久久久久电影 | 91香蕉视频在线| 精品国产精品一区二区夜夜嗨| 亚洲男女毛片无遮挡| 国产美女精品一区二区三区| 91麻豆精品国产91久久久资源速度| 国产精品素人一区二区| 蜜臀精品一区二区三区在线观看 | 一区二区三区欧美激情| 国v精品久久久网| 日韩一级黄色大片| 亚洲成人7777| 91免费看`日韩一区二区| 国产亚洲午夜高清国产拍精品| 免费人成在线不卡| 欧美日韩黄色影视| 一区二区免费看| 97成人超碰视| 一区二区中文视频| 国产成a人亚洲| 精品福利一区二区三区 | 欧美日本免费一区二区三区| 最新热久久免费视频| 国产成人免费xxxxxxxx| 2020国产精品自拍| 久久精品国产亚洲一区二区三区 | 亚洲不卡一区二区三区| 色乱码一区二区三区88| 国产精品成人一区二区三区夜夜夜| 久久99久久精品| 日韩视频一区二区在线观看| 日本三级韩国三级欧美三级| 在线成人小视频| 日韩福利电影在线观看| 欧美日本韩国一区二区三区视频| 亚洲午夜av在线| 欧美精品视频www在线观看| 欧美在线视频全部完| 亚洲欧洲制服丝袜| 99精品国产热久久91蜜凸| 国产精品久久久久aaaa樱花 | 日韩免费看网站| 狠狠久久亚洲欧美| 国产夜色精品一区二区av| 国产精品一线二线三线| 国产性天天综合网| caoporn国产精品| 一区二区三区精品在线观看| 欧美伊人久久久久久久久影院| 亚洲精品视频自拍| 欧美色图一区二区三区| 香蕉成人啪国产精品视频综合网| 欧美日韩一区二区不卡| 日韩av不卡在线观看| 久久综合色之久久综合| 成人一区二区三区视频在线观看 | 蜜臀va亚洲va欧美va天堂| 精品国产在天天线2019| 国产高清在线观看免费不卡| 中文字幕一区二区三区在线不卡| 91丝袜呻吟高潮美腿白嫩在线观看| 亚洲女人****多毛耸耸8| 欧美日韩亚洲高清一区二区| 丝袜美腿成人在线| 欧美精品一区二区不卡| 99riav久久精品riav| 亚洲成人动漫在线免费观看| 欧美刺激脚交jootjob| 国产成人午夜精品5599| 自拍偷拍欧美激情| 欧美人伦禁忌dvd放荡欲情| 韩国av一区二区三区在线观看| 欧美国产精品一区二区| 欧美私模裸体表演在线观看| 日本成人在线一区| 国产精品免费丝袜| 欧美日韩国产123区| 国产精品白丝av| 亚洲国产精品久久久男人的天堂 | 亚洲情趣在线观看| 欧美一级日韩免费不卡| 岛国av在线一区| 亚洲成人7777| 中文字幕高清不卡| 91麻豆精品久久久久蜜臀| 成人午夜短视频| 日韩精品视频网站| 成人欧美一区二区三区1314| 欧美绝品在线观看成人午夜影视| 激情久久五月天| 亚洲精品国产视频| 国产午夜一区二区三区| 欧美日韩久久久一区| 国产成人精品三级麻豆| 亚洲成人精品在线观看| 国产欧美日韩精品一区| 91精品蜜臀在线一区尤物| 成人国产亚洲欧美成人综合网| 日韩 欧美一区二区三区| 99精品欧美一区二区蜜桃免费| 麻豆成人免费电影| 一区二区三区在线影院| 日本一区二区三级电影在线观看| 精品1区2区3区| 99久久国产综合精品麻豆| 精品午夜一区二区三区在线观看| 亚洲黄色免费电影| 国产欧美一区二区精品仙草咪| 欧美二区在线观看| 在线观看日韩高清av| 国产成人av自拍| 理论片日本一区| 丝袜国产日韩另类美女| 一区二区三区免费观看| 国产精品私人自拍| 欧美精品一区二| 欧美一区二区国产| 欧美午夜片在线观看| av中文字幕亚洲| 国产成人精品免费一区二区| 久久成人久久鬼色| 日韩电影免费一区| 午夜成人免费电影| 亚洲一二三四在线| 怡红院av一区二区三区| 国产精品成人免费 | 国产一区在线观看麻豆| 蜜桃视频免费观看一区| 一区二区三区高清不卡| 亚洲人成伊人成综合网小说| 国产精品欧美精品| 欧美激情艳妇裸体舞| 国产三级精品视频| 久久精品人人做人人爽人人| 26uuu色噜噜精品一区二区|