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

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

?? ecc_16bit_tb.v

?? 本電子檔為 verilog cookbook,包含了通訊,影像,DSP等重要常用之verilog編碼,可作為工程師與初學者的參考手冊
?? V
字號:
// Copyright 2007 Altera Corporation. All rights reserved.  
// Altera products are protected under numerous U.S. and foreign patents, 
// maskwork rights, copyrights and other intellectual property laws.  
//
// This reference design file, and your use thereof, is subject to and governed
// by the terms and conditions of the applicable Altera Reference Design 
// License Agreement (either as signed by you or found at www.altera.com).  By
// using this reference design file, you indicate your acceptance of such terms
// and conditions between you and Altera Corporation.  In the event that you do
// not agree with such terms and conditions, you may not use the reference 
// design file and please promptly destroy any copies you have made.
//
// This reference design file is being provided on an "as-is" basis and as an 
// accommodation and therefore all warranties, representations or guarantees of 
// any kind (whether express, implied or statutory) including, without 
// limitation, warranties of merchantability, non-infringement, or fitness for
// a particular purpose, are specifically disclaimed.  By making this reference
// design file available, Altera expressly does not recommend, suggest or 
// require that this reference design file be used in combination with any 
// other product not provided by Altera.
/////////////////////////////////////////////////////////////////////////////

// baeckler - 07-10-2006
//   revd 08-25-2006

module ecc_16bit_tb ();

// this should be the sum of encode and 
// decode registers
parameter TOTAL_LATENCY = 2;

parameter DATA_BITS = 16;
parameter TOTAL_BITS = 22;

reg [DATA_BITS-1:0] data_in,next_data_in;
wire [TOTAL_BITS-1:0] code_out;
reg [TOTAL_BITS-1:0] error_sig,next_error_sig;
wire [TOTAL_BITS-1:0] damaged_code;
wire [DATA_BITS-1:0] recovered_data;
wire no_err,err_corrected,err_fatal;

reg clk,rst;

///////////////////////
// encoder unit
///////////////////////
ecc_encode_16bit enc
(
	.d(data_in),
	.c(code_out)
);

///////////////////////
// insert optional error 
///////////////////////
reg [2:0] num_errors, next_num_errors;
assign damaged_code = code_out ^ error_sig;

///////////////////////
// decoder unit 
///////////////////////
ecc_decode_16bit dec 
(
	.clk(clk),
	.rst(rst),
	.c(damaged_code),
	.d(recovered_data),
	.no_err(no_err),
	.err_corrected(err_corrected),
	.err_fatal(err_fatal)
);
defparam dec .MIDDLE_REG = 1;
defparam dec .OUTPUT_REG = 1;


////////////////////////
// main control 
////////////////////////
reg fail;
reg [TOTAL_LATENCY:0] flushing;

initial begin
	clk = 0;
	rst = 0;
	num_errors = 0;
	error_sig = 0;
	data_in = 0;
	fail = 0;

	#10 rst = 1;
	#10 rst = 0;

	// wait for the pipe to fill
	#10
	if (!flushing[TOTAL_LATENCY]) begin
		@(posedge flushing[TOTAL_LATENCY]);
	end
	fail = 0;

	#10000000 if (!fail) $display ("PASS"); 
	else $display ("FAIL");
	$stop();
end

integer n = 0;
reg [6:0] which_bit;

////////////////////////
// new random stimulus
////////////////////////
always @(negedge clk or posedge rst) begin
	next_data_in = {$random,$random};
	
	// create an error signal with a few randomly
	// placed 1's.
	next_num_errors = $random;
	next_num_errors = next_num_errors % 5;

	next_error_sig = 0;
	for (n=0; n<next_num_errors; n=n+1)
	begin
		which_bit = $random;
		which_bit = which_bit % TOTAL_BITS;
		while (next_error_sig[which_bit]) 
		begin
			which_bit = (which_bit + 1) % TOTAL_BITS;	
		end
		next_error_sig[which_bit] = 1'b1;
	end
end

always @(posedge clk or posedge rst) begin
	if (rst) begin
		num_errors <= 0;
		error_sig <= 0;
		data_in <= 0;
	end
	else begin
		num_errors <= next_num_errors;
		data_in <= next_data_in;
		error_sig <= next_error_sig;
	end
end

///////////////////////
// latency matching 
///////////////////////
reg [DATA_BITS-1:0] delayed_data [TOTAL_LATENCY:0];
reg [2:0] delayed_num_errors [TOTAL_LATENCY:0];
integer i ;

always @(posedge clk or posedge rst) begin
	if (rst) begin
		flushing <= 1'b1;
	end
	else begin
		flushing <= flushing | (flushing << 1'b1);
		for (i=TOTAL_LATENCY; i>0; i=i-1) begin
			delayed_data[i] <= delayed_data[i-1];
			delayed_num_errors[i] <= delayed_num_errors[i-1];
		end
	end
end

always @(*) begin
	delayed_num_errors[0] = num_errors;
	delayed_data[0] = data_in;
end

///////////////////////////////
// capture and check results 
///////////////////////////////

integer wrong_bits = 0;
reg [DATA_BITS-1:0] recovered_error;

integer stats_3bit_pass = 0;
integer stats_3bit_one = 0;
integer stats_3bit_two = 0;

integer stats_4bit_pass = 0;
integer stats_4bit_one = 0;
integer stats_4bit_two = 0;

integer z;

always @(posedge clk or posedge rst) begin
	#20
		
	// count the number of wrong bits in the 
	// recovered data.
	wrong_bits = 0;
	recovered_error = delayed_data[TOTAL_LATENCY] ^ recovered_data;
	for (z=0;z<64;z=z+1)
	begin
		if (recovered_error[z]) wrong_bits = wrong_bits + 1;
	end

	#1
			
	if (delayed_num_errors[TOTAL_LATENCY] == 0) begin
		if (wrong_bits !== 0) fail = 1;
		if ({no_err,err_corrected,err_fatal} !== 3'b100) fail = 1;
	end
	else if (delayed_num_errors[TOTAL_LATENCY] == 1) begin
		// 1 bit errors need to be flagged and repaired
		if (wrong_bits !== 0) fail = 1;
		if ({no_err,err_corrected,err_fatal} !== 3'b010) fail = 1;
	end
	else if (delayed_num_errors[TOTAL_LATENCY] == 2) begin
		// 2 bit errors need to be detected
		// and not made any worse
		if (wrong_bits > 2) fail = 1;
		if ({no_err,err_corrected,err_fatal} !== 3'b001) fail = 1;
	end	
	else if (delayed_num_errors[TOTAL_LATENCY] == 3) begin
		// 3 bit errors need to be detected as parity error
		// they will be mistakenly corrected as 1 bit errors
		if ({no_err,err_corrected,err_fatal} == 3'b100) 
			stats_3bit_pass = stats_3bit_pass + 1;
		else if ({no_err,err_corrected,err_fatal} == 3'b010) 
			stats_3bit_one = stats_3bit_one + 1;
		else if ({no_err,err_corrected,err_fatal} == 3'b001) 
			stats_3bit_two = stats_3bit_two + 1;				
	end
	else begin
		// 4 + bit errors
		if ({no_err,err_corrected,err_fatal} == 3'b100) 
			stats_4bit_pass = stats_4bit_pass + 1;
		else if ({no_err,err_corrected,err_fatal} == 3'b010) 
			stats_4bit_one = stats_4bit_one + 1;
		else if ({no_err,err_corrected,err_fatal} == 3'b001) 
			stats_4bit_two = stats_4bit_two + 1;				
	end

	// early exit for failure
	if (fail) begin
		#100 $display ("Mismatch at time %d",$time);
		$stop();
	end
end

always begin
	#100 clk = ~clk;
end

endmodule

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品视频一区二区三区免费| 中文字幕一区三区| 国产精品视频观看| 五月天一区二区三区| 国产成人免费av在线| 欧美美女网站色| 国产精品久久久久永久免费观看 | 亚洲国产精品99久久久久久久久| 亚洲18女电影在线观看| 成人三级伦理片| 精品对白一区国产伦| 亚洲成av人片一区二区| 大陆成人av片| 国产日本欧洲亚洲| 久久99热狠狠色一区二区| 精品视频免费在线| 亚洲精品欧美在线| 色噜噜狠狠成人中文综合 | 亚洲精品v日韩精品| 国产精品一区二区久久精品爱涩 | 久久99久久99精品免视看婷婷 | 日韩成人免费电影| 欧洲av在线精品| 亚洲色欲色欲www| 成人综合婷婷国产精品久久免费| 久久综合成人精品亚洲另类欧美 | 国产成人综合精品三级| 精品日韩成人av| 久久国产欧美日韩精品| 欧美一区二区二区| 蜜桃在线一区二区三区| 欧美一区二区三区不卡| 日韩成人伦理电影在线观看| 欧美一区二区国产| 日本vs亚洲vs韩国一区三区二区| 在线综合+亚洲+欧美中文字幕| 亚洲成人av一区二区三区| 884aa四虎影成人精品一区| 天天综合日日夜夜精品| 日韩一区二区三| 激情小说欧美图片| 久久久91精品国产一区二区三区| 国产一区美女在线| 中文字幕久久午夜不卡| 99re这里都是精品| 一区二区免费在线播放| 欧美精品乱人伦久久久久久| 免费成人美女在线观看| 久久久久99精品国产片| av成人免费在线观看| 亚洲久本草在线中文字幕| 欧美日韩午夜影院| 久久超碰97中文字幕| 欧美激情综合五月色丁香| 91免费版在线看| 蜜臀久久99精品久久久画质超高清| 日韩免费一区二区| 不卡一二三区首页| 亚洲第一狼人社区| 久久免费偷拍视频| 色偷偷成人一区二区三区91| 日韩av网站在线观看| 国产女主播在线一区二区| 91成人国产精品| 久久99精品国产麻豆婷婷| 国产精品看片你懂得| 欧美猛男男办公室激情| 高清在线不卡av| 亚洲国产精品久久艾草纯爱| 久久久久久一二三区| 在线观看精品一区| 国产综合成人久久大片91| 亚洲免费在线观看| 精品理论电影在线观看| 91黄色免费版| 国产精品一区二区免费不卡| 午夜精品福利视频网站| 欧美激情中文不卡| 日韩一级片在线观看| 99国产欧美另类久久久精品| 精品一二三四在线| 亚洲高清在线视频| 亚洲一区在线观看网站| 久久奇米777| 欧美精品高清视频| 一本久道久久综合中文字幕| 国产一区视频导航| 日韩经典中文字幕一区| 亚洲欧美另类图片小说| 国产欧美精品一区| 精品国产乱码久久久久久浪潮| 欧美自拍偷拍午夜视频| av午夜一区麻豆| 国产精品456| 久久99精品网久久| 麻豆中文一区二区| 五月激情综合网| 亚洲亚洲精品在线观看| 亚洲人成网站影音先锋播放| 中文字幕成人av| 欧美激情一区二区三区不卡| 久久夜色精品国产噜噜av| 欧美一区二区精品在线| 欧美日韩国产一级片| 在线视频你懂得一区二区三区| 成人激情综合网站| 成人毛片老司机大片| 风间由美性色一区二区三区| 国产一区二区精品在线观看| 久久国产尿小便嘘嘘尿| 久久国产尿小便嘘嘘| 蜜桃视频一区二区| 久久爱另类一区二区小说| 欧美aaa在线| 久久超碰97中文字幕| 国产一二三精品| 国产成人av电影在线播放| 国产精品一二三区在线| 成人性生交大片免费看视频在线| 成人网在线免费视频| 成人av网址在线| 91福利资源站| 欧美日韩精品欧美日韩精品| 在线不卡免费av| 亚洲欧美中日韩| 一区二区三区欧美视频| 亚洲成人午夜电影| 蜜桃av一区二区在线观看| 国产一级精品在线| 成人免费va视频| 91官网在线观看| 日韩一区二区在线播放| 精品99一区二区三区| 国产精品久线在线观看| 亚洲午夜视频在线观看| 欧美aⅴ一区二区三区视频| 久久av中文字幕片| 不卡一二三区首页| 欧美日本一区二区三区四区| 欧美成人猛片aaaaaaa| 国产精品久久久久久久久免费丝袜| 亚洲精品福利视频网站| 婷婷丁香激情综合| 国产精品亚洲一区二区三区妖精| av在线不卡免费看| 欧美高清www午色夜在线视频| 欧美精品一区二区不卡 | 精品精品欲导航| 中文字幕在线观看一区| 日本在线观看不卡视频| 成人性色生活片| 欧美精品久久99| |精品福利一区二区三区| 日韩高清在线一区| 成人av免费网站| 日韩视频不卡中文| 亚洲免费看黄网站| 国产一区二区不卡| 欧美熟乱第一页| 中文字幕乱码一区二区免费| 亚洲不卡av一区二区三区| 粉嫩在线一区二区三区视频| 欧美日韩日日摸| 国产精品免费丝袜| 狂野欧美性猛交blacked| 91麻豆免费看片| 国产欧美一区二区精品性色| 热久久久久久久| 欧美影院一区二区| 国产精品久久久久久亚洲毛片| 久热成人在线视频| 欧美日韩另类国产亚洲欧美一级| 国产精品女主播在线观看| 精品中文av资源站在线观看| 欧美影院午夜播放| 亚洲免费观看在线观看| 国产99一区视频免费| 欧美成人a在线| 三级欧美在线一区| 欧美亚洲高清一区二区三区不卡| 中文字幕成人av| 国产.欧美.日韩| 国产亚洲精品aa| 精东粉嫩av免费一区二区三区| 欧美欧美午夜aⅴ在线观看| 亚洲精品国产精华液| 91色视频在线| 国产精品久久久久久户外露出| 国产剧情一区在线| 精品盗摄一区二区三区| 亚洲mv在线观看| 亚洲精品一区二区三区影院| 石原莉奈在线亚洲二区| 欧美日韩日日摸| 午夜一区二区三区在线观看| 欧美日韩一卡二卡| 亚洲午夜久久久久久久久电影网 | 亚洲第四色夜色| 欧美私人免费视频| 丝袜诱惑制服诱惑色一区在线观看|