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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gencrc.v.txt

?? verilog實例100多個
?? TXT
字號:
//
// Behavioral Verilog for CRC16 and CRC32 for use in a testbench.
//
// The specific polynomials and conventions regarding bit-ordering etc.
// are specific to the Cable Modem DOCSIS protocol, but the general scheme
// should be reusable for other types of CRCs with some fiddling.
//
// This CRC code works for a specific type of network protocol, and it
// must do certain byte swappings, etc.  You may need to play with it 
// for your protocol.  Also, make sure the polynomials are what you
// really want.  This is obviously, not synthesizable - I just used this
// in a testbench at one point.
//
// These tasks are crude and rely on some global parameters.  They should
// also read from a file, yada yada yada.  It is probably better to do this 
// with a PLI call, but here it is anyway..
//
// The test case includes a golden DOCSIS (Cable Modem) test message that 
// was captured in a lab.
//
// tom coonan, 1999.
//
module test_gencrc;

// *** Buffer for the Golden Message ***
reg [7:0]	test_packet[0:54];  

// *** Global parameter block for the CRC32 calculator.
//
parameter	CRC32_POLY = 32'h04C11DB7;
reg [ 7:0]	crc32_packet[0:255];
integer		crc32_length;
reg [31:0]	crc32_result;

// *** Global parameter block for the CRC16 calculator.
//
parameter	CRC16_POLY = 16'h1020;
reg [ 7:0]	crc16_packet[0:255];
integer		crc16_length;
reg [15:0]	crc16_result;

`define TEST_GENCRC
`ifdef TEST_GENCRC
// Call the main test task and then quit.
//
initial begin
   main_test;
   $finish;
end
`endif

// ****************************************************************
// *
// *   GOLDEN MESSAGE
// *
// *   The golden message is a DOCSIS frame that was captured off
// *   the Broadcom reference design.  It is a MAP message.  It
// *   includes a HCS (crc 16) and a CRC32.
// *
// *
// ****************************************************************
//
task initialize_test_packet;
   begin
      test_packet[00] = 8'hC2;	// FC.   HCS coverage starts here.
      test_packet[01] = 8'h00;	// MACPARAM
      test_packet[02] = 8'h00;	// MAC LEN
      test_packet[03] = 8'h30;	// MAC LEN.  HCS Coverage includes this byte and ends here.
      test_packet[04] = 8'hF2;	// CRC16 (also known as HCS)
      test_packet[05] = 8'hCF;	// CRC16 cont..
      test_packet[06] = 8'h01;	// Start of the IEEE payload.  CRC32 covererage starts here.  This is the DA field
      test_packet[07] = 8'hE0;	// DA field cont..
      test_packet[08] = 8'h2F;	// DA field cont..
      test_packet[09] = 8'h00;	// DA field cont..
      test_packet[10] = 8'h00;	// DA field cont..
      test_packet[11] = 8'h01;	// DA field cont..
      test_packet[12] = 8'h00;	// SA field
      test_packet[13] = 8'h80;	// SA field cont..
      test_packet[14] = 8'h42;	// SA field cont..
      test_packet[15] = 8'h42;	// SA field cont..
      test_packet[16] = 8'h20;	// SA field cont..
      test_packet[17] = 8'h9E;	// SA field cont..
      test_packet[18] = 8'h00;	// IEEE LEN field
      test_packet[19] = 8'h1E;	// IEEE LEN field cont.
      test_packet[20] = 8'h00;	// LLC field.
      test_packet[21] = 8'h00;	// LLC field cont...
      test_packet[22] = 8'h03;	// LLC field cont...
      test_packet[23] = 8'h01;	// LLC field cont...
      test_packet[24] = 8'h03;	// LLC field cont...  This is also the TYPE, which indicates MAP.
      test_packet[25] = 8'h00;	// LLC field cont...
      test_packet[26] = 8'h01;	// Start of MAP message payload.
      test_packet[27] = 8'h01;	// MAP message payload..
      test_packet[28] = 8'h02;	// MAP message payload..
      test_packet[29] = 8'h00;	// MAP message payload..
      test_packet[30] = 8'h00;	// MAP message payload..
      test_packet[31] = 8'h18;	// MAP message payload..
      test_packet[32] = 8'hAA;	// MAP message payload..
      test_packet[33] = 8'h58;	// MAP message payload..
      test_packet[34] = 8'h00;	// MAP message payload..
      test_packet[35] = 8'h18;	// MAP message payload..
      test_packet[36] = 8'hA8;	// MAP message payload..
      test_packet[37] = 8'hA0;	// MAP message payload..
      test_packet[38] = 8'h02;	// MAP message payload..
      test_packet[39] = 8'h03;	// MAP message payload..
      test_packet[40] = 8'h03;	// MAP message payload..
      test_packet[41] = 8'h08;	// MAP message payload..
      test_packet[42] = 8'hFF;	// MAP message payload..
      test_packet[43] = 8'hFC;	// MAP message payload..
      test_packet[44] = 8'h40;	// MAP message payload..
      test_packet[45] = 8'h00;	// MAP message payload..
      test_packet[46] = 8'h00;	// MAP message payload..
      test_packet[47] = 8'h01;	// MAP message payload..
      test_packet[48] = 8'hC0;	// MAP message payload..
      test_packet[49] = 8'h14;	// Last byte of MAP payload, last byte covered by CRC32.
      test_packet[50] = 8'hDD;	// CRC32 Starts here
      test_packet[51] = 8'hBF;	// CRC32 cont..
      test_packet[52] = 8'hC1;	// CRC32 cont..
      test_packet[53] = 8'h2E;	// Last byte of CRC32, last byte of DOCSIS.
   end
endtask

// *************************************************************************
// *
// *   Main test task.
// *
// *   Use our primary "golden packet".  Copy into the generic global
// *   variables that the low-level 'gencrc16' and 'gencrc32' tasks use.
// *   Comare against the expected values and report SUCCESS or FAILURE.
// *
// *************************************************************************
//
task main_test;
   integer	i, j;
   integer	num_errors;
   reg [15:0]	crc16_expected;
   reg [31:0]	crc32_expected;
   begin
   
   num_errors = 0;
   
   // Initialize the Golden Message!
   //
   initialize_test_packet;
   
   // **** TEST CRC16
   //
   $display ("Testing CRC16:");
   //
   // Copy golden test_packet into the main crc16 buffer..
   for (i=0; i<4; i=i+1) begin
      crc16_packet[i] = test_packet[i];
   end
   crc16_expected = {test_packet[4], test_packet[5]};
   crc16_length = 4;  // Must tell test function the length
   gencrc16;  // Call main test function
   $display ("   Actual crc16_result = %h, Expected = %h", crc16_result, crc16_expected);
   if (crc16_result == crc16_expected) begin
      $display ("   Success.");
   end
   else begin
      $display ("   ERROR!!!");
      num_errors = num_errors + 1;
   end

   // **** TEST CRC16
   //
   $display ("Testing CRC32:");
   j = 0;
   for (i=6; i<50; i=i+1) begin
      crc32_packet[j] = test_packet[i];
      j = j + 1;
   end
   crc32_expected = {test_packet[50], test_packet[51], test_packet[52], test_packet[53]};
   crc32_length = 44;
   gencrc32;
   $display ("   Actual crc32_result = %h, Expected = %h", crc32_result, crc32_expected);
   if (crc32_result == crc32_expected) begin
      $display ("   Success.");
   end
   else begin
      $display ("   ERROR!!!");
      num_errors = num_errors + 1;
   end
   
   $display ("\nDone.  %0d Errors.", num_errors);
   $display ("\n");
   end
endtask


// ****************************************************************
// *
// *   Main working CRC tasks are: gencrc16, gencrc32.
// *
// *   These tasks rely on some globals (see front of program).
// *
// ****************************************************************


// Generate a (DOCSIS) CRC16.
//
// Uses the GLOBAL variables:
//
//    Globals referenced:
//       parameter	CRC16_POLY = 16'h1020;
//       reg [ 7:0]	crc16_packet[0:255];
//       integer	crc16_length;
//
//    Globals modified:
//       reg [15:0]	crc16_result;
//
task gencrc16;
   integer	byte, bit;
   reg		msb;
   reg [7:0]	current_byte;
   reg [15:0]	temp;
   begin
      crc16_result = 16'hffff;
      for (byte = 0; byte < crc16_length; byte = byte + 1) begin
         current_byte = crc16_packet[byte];
         for (bit = 0; bit < 8; bit = bit + 1) begin
            msb = crc16_result[15];
            crc16_result = crc16_result << 1;
            if (msb != current_byte[bit]) begin
               crc16_result = crc16_result ^ CRC16_POLY;
               crc16_result[0] = 1;
            end
         end
      end
      
      // Last step is to "mirror" every bit, swap the 2 bytes, and then complement each bit.
      //
      // Mirror:
      for (bit = 0; bit < 16; bit = bit + 1)
         temp[15-bit] = crc16_result[bit];
         
      // Swap and Complement:
      crc16_result = ~{temp[7:0], temp[15:8]};
   end
endtask


// Generate a (DOCSIS) CRC32.
//
// Uses the GLOBAL variables:
//
//    Globals referenced:
//       parameter	CRC32_POLY = 32'h04C11DB7;
//       reg [ 7:0]	crc32_packet[0:255];
//       integer	crc32_length;
//
//    Globals modified:
//       reg [31:0]	crc32_result;
//

task gencrc32;
   integer	byte, bit;
   reg		msb;
   reg [7:0]	current_byte;
   reg [31:0]	temp;
   begin
      crc32_result = 32'hffffffff;
      for (byte = 0; byte < crc32_length; byte = byte + 1) begin
         current_byte = crc32_packet[byte];
         for (bit = 0; bit < 8; bit = bit + 1) begin
            msb = crc32_result[31];
            crc32_result = crc32_result << 1;
            if (msb != current_byte[bit]) begin
               crc32_result = crc32_result ^ CRC32_POLY;
               crc32_result[0] = 1;
            end
         end
      end
      
      // Last step is to "mirror" every bit, swap the 4 bytes, and then complement each bit.
      //
      // Mirror:
      for (bit = 0; bit < 32; bit = bit + 1)
         temp[31-bit] = crc32_result[bit];
         
      // Swap and Complement:
      crc32_result = ~{temp[7:0], temp[15:8], temp[23:16], temp[31:24]};
   end
endtask

endmodule

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美日韩三区| 日本一区二区久久| 欧美综合亚洲图片综合区| 国产精品99久久久久久久女警| 日韩精品免费专区| 日韩不卡一二三区| 日本不卡1234视频| 久久精品国产亚洲aⅴ| 青青草一区二区三区| 韩国v欧美v日本v亚洲v| 久草这里只有精品视频| 韩国精品免费视频| 成人av先锋影音| 色综合久久综合| 欧美久久一二三四区| 在线不卡中文字幕播放| 欧美一级一级性生活免费录像| 91精品欧美久久久久久动漫| 久久综合九色综合久久久精品综合| 国产亚洲欧美中文| 国产精品久久福利| 亚洲第一福利一区| 精品在线免费视频| 99久久精品情趣| 在线综合亚洲欧美在线视频| 久久亚洲影视婷婷| 亚洲精品日韩综合观看成人91| 日韩激情一区二区| 99精品视频一区二区| 欧美一区二区三区在线观看视频| 久久久久久久综合色一本| 一区二区三区在线影院| 男人操女人的视频在线观看欧美| 国产成人福利片| 欧美老女人在线| 国产欧美日韩不卡| 日本成人在线一区| 91在线你懂得| 精品国产乱码久久久久久夜甘婷婷| 国产精品美女久久久久aⅴ | 亚洲夂夂婷婷色拍ww47| 日本系列欧美系列| 日本高清不卡aⅴ免费网站| 日韩写真欧美这视频| 亚洲私人黄色宅男| 狠狠色狠狠色综合日日91app| 91色porny在线视频| 精品精品欲导航| 亚洲午夜久久久久| 成人av免费观看| 久久亚洲私人国产精品va媚药| 亚洲va天堂va国产va久| 成人黄色在线看| 久久夜色精品一区| 久久精品国产99国产精品| 欧美日韩国产精品成人| 亚洲精品一二三四区| 成人h精品动漫一区二区三区| 精品人伦一区二区色婷婷| 亚欧色一区w666天堂| 色久综合一二码| 亚洲另类色综合网站| 国产v综合v亚洲欧| 久久综合久久鬼色中文字| 麻豆精品一区二区| 91精品国产91久久久久久最新毛片| 亚洲综合色丁香婷婷六月图片| 91在线观看美女| 亚洲视频在线观看一区| 成人黄色国产精品网站大全在线免费观看 | 久久成人羞羞网站| 欧美一区二区三区免费观看视频| 一区二区三区波多野结衣在线观看| gogogo免费视频观看亚洲一| 国产视频一区不卡| 国产成人一级电影| 国产精品天干天干在线综合| 国产高清精品久久久久| 国产精品你懂的在线欣赏| 国产剧情一区二区| 国产婷婷色一区二区三区在线| 成人一区二区三区视频在线观看| 中文av一区二区| 一本一道久久a久久精品综合蜜臀| 亚洲欧洲精品天堂一级| 色av成人天堂桃色av| 亚洲人成网站在线| 欧美日韩中文国产| 人人爽香蕉精品| 久久久一区二区三区捆绑**| 国产乱码精品一区二区三区五月婷| 精品久久久网站| 国产suv精品一区二区6| 亚洲精品乱码久久久久久久久| 欧美中文字幕亚洲一区二区va在线| 婷婷激情综合网| 久久嫩草精品久久久精品| 99久久免费视频.com| 亚洲va韩国va欧美va| 精品国产第一区二区三区观看体验| 国产酒店精品激情| 亚洲一二三四在线| 精品国产欧美一区二区| 91在线精品一区二区| 麻豆一区二区三| 中文字幕欧美区| 欧美久久久影院| 成人免费高清在线| 亚洲成人1区2区| 国产精品高潮呻吟| 日韩精品中文字幕一区二区三区| 成人国产亚洲欧美成人综合网| 亚洲1区2区3区视频| 国产亚洲美州欧州综合国| 欧美三日本三级三级在线播放| 国产一区二三区好的| 一级做a爱片久久| 久久精品在这里| 欧美一区日本一区韩国一区| 99久久精品免费看| 国产在线观看免费一区| 亚洲第一主播视频| 亚洲美女精品一区| 日本一区二区综合亚洲| 日韩欧美国产精品一区| 欧美性欧美巨大黑白大战| 国产精品18久久久久久vr| 丝袜亚洲精品中文字幕一区| 亚洲色图清纯唯美| 久久久三级国产网站| 欧美日韩视频在线第一区| 91原创在线视频| 国产91精品在线观看| 久久成人18免费观看| 天天做天天摸天天爽国产一区| 国产精品亲子乱子伦xxxx裸| www一区二区| 欧美大片一区二区| 欧美日韩久久不卡| 欧洲av一区二区嗯嗯嗯啊| 国产在线一区观看| 免费久久精品视频| 免费久久99精品国产| 日本女人一区二区三区| 日本午夜精品视频在线观看| 午夜精品久久久久久久久| 亚洲亚洲人成综合网络| 亚洲一区国产视频| 亚洲高清在线精品| 亚洲mv大片欧洲mv大片精品| 亚洲综合免费观看高清完整版在线| 亚洲欧美日韩在线| 亚洲三级免费电影| 一区二区三区欧美日| 亚洲欧洲在线观看av| 成人免费一区二区三区视频| 中文字幕一区二区在线播放 | 日本久久一区二区三区| www.激情成人| 99精品欧美一区| 欧洲一区二区三区免费视频| 欧美性三三影院| 欧美一区二区三区白人| 欧美一个色资源| 精品国产3级a| 久久久久久9999| 国产精品乱人伦一区二区| 亚洲嫩草精品久久| 日韩精品一区第一页| 蜜臀久久久久久久| 国产九九视频一区二区三区| 成人h动漫精品一区二区| 91免费国产在线| 91精品国产综合久久精品图片| 精品久久久久久久久久久久久久久 | 91亚洲永久精品| 欧美在线影院一区二区| 日韩网站在线看片你懂的| 久久久久久久网| 亚洲乱码国产乱码精品精可以看 | 日韩影视精彩在线| 国产麻豆成人精品| 在线免费观看不卡av| 日韩欧美高清在线| 中文字幕制服丝袜成人av| 亚洲综合免费观看高清完整版 | 成人av在线网站| 欧美日韩专区在线| 精品国产乱码久久久久久影片| 国产精品久久久久aaaa| 蜜桃91丨九色丨蝌蚪91桃色| bt7086福利一区国产| 欧美一区二区三区啪啪| 综合久久国产九一剧情麻豆| 午夜激情综合网| 91美女在线看| 久久久久久免费毛片精品| 亚洲一区国产视频| 北条麻妃一区二区三区| 日韩三级视频中文字幕|