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

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

?? div16.v

?? some example for verilog design
?? V
字號(hào):
//
// Integer Multicycle Divide circuit (divide a 16-bit number by a 16-bit number in 16 cycles).
//
// a / b = q with remainder r
//
// Where a is 16-bits,
// Where b is 16 bits
//
// Module is actually parameterized if you want other widths.
//
// *** Test the ranges of values for which you'll use this.  For example, you
//     can't divide FFFF by FF without underflow (overflow?).  Mess with
//     the testbench.  You may need to widen some thing.  ***
//
// The answer is 16-bits and the remainder is also 16-bits.
// After the start pulse, the module requires 16 cycles to complete.
// The q/r outputs stay the same until next start pulse.
// Start pulse should be a single cycle.
// Division by zero results in a quotient equal to FFFF and remainder equal to 'a'.
//
// 
// Written by tom coonan.
//
// Notes:
//    - This ain't fancy.  I wanted something straight-forward quickly.  Go study
//      more elaborate algorithms if you want to optimize area or speed.  If you
//      have an isolated divide and can spare N cycles for N bits; this may meet your needs.
//    - You might want to think more about the sizes of things.  I wanted a basic estimate
//      of gates plus I specifically needed to divide 16-bits (not even full range)
//      by 8-bits.
//    - Handle divide by zero at higher level..
//    - I needed a remainder so I could easily to truncate and rounding stuff,
//      but remove this to save gates if you don't need a remainder.
//    - This is about 800 asic gates (0.25um, Standard Cell, 27Mhz).  27Mhz
//      is my system clock and NOT the maximum it can go..
//    - I tried to keep everything parameterized by N, but I only worked through
//      the N=16 case because that's what I needed...
//
module div16 (clk, resetb, start, a, b, q, r, done);

parameter N = 16;	// a/b = q remainder r, where all operands are N wide.

input		clk;
input		resetb;	// Asynchronous, active low reset.
input		start;	// Pulse this to start the division.
input [N-1:0]	a;	// This is the number we are dividing (the dividend)
input [N-1:0]	b;	// This is the 'divisor'
output [N-1:0]	q;	// This is the 'quotient'
output [N-1:0]	r;	// Here is the remainder.
output		done;	// Will be asserted when q and r are available.

// Registered q
reg [N-1:0]	q;
reg		done;

// Power is the current 2^n bit we are considering.  Power is a shifting
// '1' that starts at the highest power of 2 and goes all the way down
// to ...00001  Shift this until it is zero at which point we stop.
//
reg [N-1:0]	power;

// This is the accumulator.  We are start with the accumulator set to 'a' (the dividend).
// For each (divisor*2^N) term, we see if we can subtract (divisor*2^N) from the accumulator.
// We subtract these terms as long as adding in the term doesn't cause the accumulator
// to exceed a.  When we are done, whatever is left in the accumulator is the remainder.
//
reg [N-1:0]	accum;

// This is the divisor*2^N term.  Essentually, we are taking the divisor ('b'), initially
// shifting it all the way to the left, and shifting it 1 bit at a time to the right.
//
reg [(2*N-1):0]	bpower;

// Remainder will be whatever is left in the accumulator.
assign r = accum;

// Do this addition here for resource sharing.  
// ** Note that 'accum' is N bits wide, but bpower is 2*N-1 bits wide **
//
wire [2*N-1:0] accum_minus_bpower = accum - bpower;

always @(posedge clk or negedge resetb) begin
   if (~resetb) begin
      q <= 0;
      accum <= 0;
      power <= 0;
      bpower <= 0;
      done <= 0;
   end
   else begin
      if (start) begin
         // Reinitialize the divide circuit.
         q      <= 0;
         accum  <= a; // Accumulator initially gets the dividend.  
         power[N-1] <= 1'b1; // We start with highest power of 2 (which is a '1' in MSB)
         bpower <= b << N-1; // Start with highest bpower, which is (divisor * 2^(N-1))
         done <= 0;
      end
      else begin
         // Go until power is zero.
         //
         if (power != 0) begin
            //
            // Can we add this divisor*2^(power) to the accumulator without going negative?
            // Just test the MSB of the subtraction.  If it is '1', then it must be negative.
            //
            if ( ~accum_minus_bpower[2*N-1]) begin
               // Yes!  Set this power of 2 in the quotieny and
               // then actually comitt to the subtraction from our accumulator.
               //
               q     <= q | power;
               accum <= accum_minus_bpower;
            end
            // Regardless, always go to next lower power of 2.
            //
            power  <= power >> 1;
            bpower <= bpower >> 1;
         end
         else begin
            // We're done.  Set done flag.
            done <= 1;
         end
      end
   end
end
endmodule //of div16

// synopsys translate_off
module test_div16;
reg		clk;
reg		resetb;
reg		start;
reg [15:0]	a;
reg [15:0]	b;
wire [15:0]	q;
wire [15:0]	r;
wire		done;

integer		num_errors;

div16 div16 (
   .clk(clk),
   .resetb(resetb),
   .start(start),
   .a(a),
   .b(b),
   .q(q),
   .r(r),
   .done(done)
);

initial begin
   num_errors = 0;
   
   start = 0;
   
   // Wait till reset is completely over.
   #200;
   
   // Do some divisions where divisor is constrained to 8-bits and dividend is 16-bits
   $display ("16-bit Dividend, 8-bit divisor");
   repeat (25) begin
      do_divide ($random, $random & 255);
   end
   
   // Do some divisions where divisor is constrained to 12-bits and dividend is 16-bits
   $display ("\n16-bit Dividend, 12-bit divisor");
   repeat (25) begin
      do_divide ($random, $random & 4095);
   end
   
   // Do some divisions where both divisor and dividend is 16-bits
   $display ("\n16-bit Dividend, 16-bit divisor");
   repeat (25) begin
      do_divide ($random, $random);
   end
   
   // Special cases
   $display ("\nSpecial Cases:");
   do_divide (16'hFFFF,  16'hFFFF); // largest possible quotient
   do_divide (312,  1); // divide by 1
   do_divide (  0, 42); // divide 0 by something else
   do_divide (312,  0); // divide by zero

   // That's all.  Summarize the test.
   if (num_errors === 0) begin
      $display ("\n\nSUCCESS.  There were %0d Errors.", num_errors);
   end
   else begin
      $display ("\n\nFAILURE!!  There were %0d Errors.", num_errors);
   end
   
   $finish;
end

task do_divide;
   input [15:0] arga;
   input [15:0] argb;
   
   begin
      a = arga;
      b = argb;
      @(posedge clk);
      #1 start = 1;
      @(posedge clk);
      #1 start = 0;
      while (~done) @(posedge clk);
      #1;
      
      $display ("Circuit: %0d / %0d = %0d, rem = %0d \t\t......... Reality: %0d, rem = %0d", arga, argb, q, r, a/b, a%b);
      if (b !== 0) begin
         if (q !== a/b) begin
            $display ("   Error!  Unexpected Quotient\n\n");
            num_errors = num_errors + 1;
         end
         if (r !== a % b) begin
            $display ("   Error!  Unexpected Remainder\n\n");
            num_errors = num_errors + 1;
         end
      end
   end
endtask

initial begin
   clk = 0;
   forever begin
      #10 clk = 1;
      #10 clk = 0;
   end
end

initial begin
   resetb = 0;
   #133 resetb = 1;
end

initial begin
   $dumpfile ("test_div16.vcd");
   $dumpvars (0,test_div16);   
end

endmodule  //of test_div16

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区91| 成人综合在线视频| 日本视频在线一区| 亚洲精品视频自拍| 一区二区三区中文字幕电影| 亚洲精选视频在线| 亚洲精品国产第一综合99久久| 日韩一区欧美小说| 亚洲欧美日韩电影| 欧美精品久久99| 国产精品91xxx| 成人av在线一区二区三区| 国产成人夜色高潮福利影视| 高清av一区二区| 丝袜美腿亚洲一区| 亚洲国产精品国自产拍av| 中文字幕中文字幕一区二区| 综合激情网...| 一区二区三区中文在线| 午夜精品成人在线视频| 青青草97国产精品免费观看 | 日韩欧美国产精品一区| 欧美成人女星排行榜| 日韩一区二区三区视频在线| 日韩免费视频一区| 国产日韩欧美精品电影三级在线| 国产欧美一区二区精品婷婷| 中文字幕五月欧美| 亚洲视频资源在线| 亚洲图片自拍偷拍| 久久99久久精品| 成人免费视频免费观看| 免费观看91视频大全| 国产精品18久久久| 色婷婷久久久久swag精品| 欧美日本在线视频| 久久女同互慰一区二区三区| 中文字幕一区二区三区视频| 亚洲综合色网站| 蜜桃av一区二区| 处破女av一区二区| 欧美日韩不卡视频| 久久精品人人爽人人爽| 亚洲精品久久7777| 免费成人美女在线观看| 99视频精品全部免费在线| 欧美日韩免费一区二区三区| 精品乱人伦一区二区三区| 亚洲欧洲日产国产综合网| 日韩福利电影在线| 成人动漫中文字幕| 欧美美女一区二区| 国产日韩欧美综合在线| 香蕉久久一区二区不卡无毒影院| 国内精品国产成人国产三级粉色| 99re免费视频精品全部| 91麻豆精品国产无毒不卡在线观看| 中文字幕av一区二区三区免费看| 天堂va蜜桃一区二区三区漫画版| 成人a级免费电影| 制服丝袜中文字幕一区| 亚洲日穴在线视频| 久久爱另类一区二区小说| 在线观看国产91| 久久久久久久网| 日韩精品三区四区| 91成人网在线| 亚洲国产精品二十页| 另类成人小视频在线| 91香蕉视频mp4| 久久一区二区视频| 三级成人在线视频| 在线看国产一区二区| 国产欧美日韩精品a在线观看| 视频在线观看一区| 91麻豆swag| 国产欧美视频一区二区三区| 免费日本视频一区| 欧美性xxxxx极品少妇| 国产精品乱人伦| 国产精品福利一区二区三区| 另类小说图片综合网| 欧美日韩中文精品| 亚洲精选视频免费看| 成人黄色av电影| 99久久精品国产网站| 国产日韩视频一区二区三区| 看电视剧不卡顿的网站| 欧美日韩一区二区三区视频| 亚洲日本乱码在线观看| 国产精品99久久久久久似苏梦涵| 日韩视频永久免费| 秋霞国产午夜精品免费视频| 欧美日韩激情一区二区三区| 怡红院av一区二区三区| 91日韩在线专区| 亚洲私人黄色宅男| 成人av动漫在线| 国产精品美女久久久久久久| 国产成人免费视频一区| 亚洲精品在线观看视频| 美女一区二区在线观看| 欧美高清你懂得| 日韩成人精品在线观看| 3d成人h动漫网站入口| 视频一区中文字幕| 91精品国产一区二区三区| 日韩极品在线观看| 91精品国产一区二区三区香蕉| 天堂成人免费av电影一区| 欧美日韩www| 免费在线视频一区| 日韩欧美一二三区| 极品少妇一区二区三区精品视频 | 国产精品萝li| 91同城在线观看| 一区二区三区毛片| 欧美日韩在线不卡| 日日夜夜精品视频天天综合网| 欧美一区二区视频在线观看| 蜜乳av一区二区三区| 精品福利一二区| 国产盗摄一区二区三区| 国产精品国产自产拍高清av | 欧美日韩亚洲综合在线 | 另类小说一区二区三区| 国产性色一区二区| 成人黄色软件下载| 亚洲一区影音先锋| 欧美一区二区视频免费观看| 国产综合成人久久大片91| 国产欧美日韩不卡| 欧美亚洲国产一区二区三区| 爽爽淫人综合网网站| 欧美成人bangbros| 成人午夜免费电影| 一区二区三区日本| 欧美精品tushy高清| 国产精品2024| 亚洲天堂精品在线观看| 欧美巨大另类极品videosbest| 久久国产乱子精品免费女| 久久精品无码一区二区三区| 91在线视频免费91| 日韩高清中文字幕一区| 久久久蜜桃精品| 欧美三级中文字幕| 国产成人综合网站| 亚洲一区二区不卡免费| 久久综合色8888| 色综合久久66| 精彩视频一区二区| 亚洲自拍偷拍综合| 亚洲精品一区二区精华| 91免费在线播放| 毛片av中文字幕一区二区| 国产精品电影一区二区| 91麻豆精品国产91久久久久久| 国产成人av电影在线| 午夜久久久久久| 国产精品情趣视频| 欧美精品日韩综合在线| 不卡大黄网站免费看| 蜜桃av一区二区在线观看| 一区二区欧美精品| 久久久91精品国产一区二区三区| 欧美日韩精品一区二区天天拍小说| 国产盗摄女厕一区二区三区| 视频一区在线视频| 欧美日韩精品综合在线| 91伊人久久大香线蕉| 激情深爱一区二区| 亚洲电影你懂得| 成人欧美一区二区三区小说 | 欧美视频你懂的| 成人一二三区视频| 久久精品国产久精国产| 亚洲综合丝袜美腿| 国产精品久久久久久久久果冻传媒| 日韩一区二区精品葵司在线| 色婷婷香蕉在线一区二区| 国产成人丝袜美腿| 精品综合久久久久久8888| 亚洲成年人网站在线观看| 亚洲天堂网中文字| 国产日韩欧美麻豆| 日韩你懂的电影在线观看| 欧美日韩国产美| 91亚洲国产成人精品一区二区三 | 成人高清视频在线| 国产精一区二区三区| 久久成人精品无人区| 久久精品无码一区二区三区| 日韩一区二区三区在线| 在线播放欧美女士性生活| 欧美三级资源在线| 欧美性生活大片视频| 欧美在线一二三| 色94色欧美sute亚洲线路一久| av综合在线播放|