noise_gen_one_bit.v

来自「采用匹配滤波」· Verilog 代码 · 共 67 行

V
67
字号
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer:
//
// Create Date:    18:30:21 12/30/07
// Design Name:    
// Module Name:    noise_gen_one_bit
// Project Name:   
// Target Device:  
// Tool versions:  
// Description:
//
// Dependencies:
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
////////////////////////////////////////////////////////////////////////////////
module noise_gen_one_bit(clk,reset,noise_parameter,error);

	input clk,reset;
	input [6:0]noise_parameter;
	output error;

	reg [12:0]pn_1,pn_2,pn_3,pn_4,pn_5;
	reg [10:0]pn_6;
	reg [8:0]pn_7;
	reg [6:0]numb;
	reg error;

	always @(posedge clk or posedge reset)
		begin
			if(reset)
				begin
					pn_1 <= 13'b0_0000_0000_0001;
					pn_2 <= 13'b0_0000_0000_0010;
					pn_3 <= 13'b0_0000_0000_0111;
					pn_4 <= 13'b0_0000_0000_1110;
					pn_5 <= 13'b0_0000_0001_1111;					
					pn_6 <=    11'b100_0000_0010;
					pn_7 <=       9'b1_0000_0011;
					numb <= 7'b0;
					error <= 1'b0;
				end
			else
				begin
					pn_1 <= {pn_1[12] ^ pn_1[11] ^ pn_1[8] ^ pn_1[0] , pn_1[12:1]};
					pn_2 <= {pn_2[12] ^ pn_2[11] ^ pn_2[2] ^ pn_2[0] , pn_2[12:1]};
					pn_3 <= {pn_3[12] ^ pn_3[11] ^ pn_3[1] ^ pn_3[0] , pn_3[12:1]}; 
				  	pn_4 <= {pn_4[12] ^ pn_4[ 2] ^ pn_4[1] ^ pn_4[0] , pn_4[12:1]};  
					pn_5 <= {pn_5[11] ^ pn_5[ 2] ^ pn_5[1] ^ pn_5[0] , pn_5[12:1]};  
					pn_6 <= {pn_6[ 9] ^ pn_6[ 0]                     , pn_6[10:1]};	 
					pn_7 <= {pn_7[ 5] ^ pn_7[ 0]                     , pn_7[ 8:1]};	  //A(4) + A(9)
					numb <= {pn_1[0] , pn_2[0] ,pn_3[0] ,pn_4[0] ,pn_5[0] ,pn_6[0] ,pn_7[0]};
					if (numb <= noise_parameter)
						error <= 1'b1;
					else
						error <= 1'b0;							
				end
		end



endmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?