Trung tâm đào tạo thiết kế vi mạch Semicon


  • ĐĂNG KÝ TÀI KHOẢN ĐỂ TRUY CẬP NHIỀU TÀI LIỆU HƠN!
  • Đăng ký
    *
    *
    *
    *
    *
    Fields marked with an asterisk (*) are required.
wafer.jpg

Thiết Kế Verilog về PARITY

Email In PDF.
Kết quả hình ảnh cho hinh anh verilogMột bit chẵn lẻ là một bit mà được thêm vào để đảm bảo rằng số lượng bit có giá trị nhất trong một bộ các bit là ngay cả hoặc lẻ . Parity bits are used as the simplest form of error detecting code . bit chẵn lẻ được sử dụng như là hình thức đơn giản nhất của lỗi phát hiện mã .

There are two variants of parity bits: even parity bit and odd parity bit . Có hai biến thể của bit chẵn lẻ: bit chẵn lẻ và bit chẵn lẻ, ngay cả lẻ. When using even parity, the parity bit is set to 1 if the number of ones in a given set of bits (not including the parity bit) is odd, making the entire set of bits (including the parity bit) even. Khi sử dụng tính chẵn lẻ thậm chí, các bit chẵn lẻ được thiết lập để 1 nếu số lượng những người thân trong một cho bộ các bit (không bao gồm các bit chẵn lẻ) là số lẻ, làm cho toàn bộ các bit (bao gồm cả bit chẵn lẻ) ngay cả. When using odd parity, the parity bit is set to 1 if the number of ones in a given set of bits (not including the parity bit) is even, making the entire set of bits (including the parity bit) odd. Khi sử dụng tính chẵn lẻ lẻ thì bit chẵn lẻ được thiết lập để 1 nếu số lượng những người thân trong một cho bộ các bit (không bao gồm các bit chẵn lẻ) là thậm chí, làm cho toàn bộ các bit (bao gồm cả bit chẵn lẻ) lẻ. In other words, an even parity bit will be set to "1" if the number of 1's + 1 is even, and an odd parity bit will be set to "1" if the number of 1's +1 is odd. Nói cách khác, một bit chẵn lẻ thậm chí sẽ được thiết lập để "1" nếu số 1 của + 1 là chẵn, và một bit chẵn lẻ lẻ sẽ được thiết lập để "1" nếu số 1 của 1 là lẻ.

Even parity is a special case of a cyclic redundancy check (CRC), where the 1-bit CRC is generated by the polynomial x +1. Ngay cả tính chẵn lẻ là một trường hợp đặc biệt của một kiểm tra dư thừa tuần hoàn (CRC), nơi mà các-bit CRC 1 được tạo ra bởi các đa thức x 1.

If the parity bit is present but not used, it may be referred to as mark parity (when the parity bit is always 1) or space parity (the bit is always 0). Nếu các bit chẵn lẻ là hiện tại nhưng không sử dụng, nó có thể được gọi là đánh dấu chẵn lẻ (khi bit chẵn lẻ luôn luôn là 1) hoặc tương đương không gian (các bit luôn luôn là 0).

1 //-----------------------------------------------------
2 // Design Name : parity_using_function
3 // File Name : parity_using_function.v
4 // Function : Parity using function
5 // Coder : -
6 //-----------------------------------------------------
7 module parity_using_function (
8 data_in , // 8 bit data in
9 parity_out // 1 bit parity out
10 );
11 output parity_out ;
12 input [7:0] data_in ;
13
14 wire parity_out ;
15
16 function parity;
17 input [31:0] data;
18 begin
19 parity = (data_in[0] ^ data_in[1]) ^
20 (data_in[2] ^ data_in[3]) ^
21 (data_in[4] ^ data_in[5]) ^
22 (data_in[6] ^ data_in[7]);
23 end
24 endfunction
25
26
27 assign parity_out = parity(data_in);
28
29 endmodule

1 //-----------------------------------------------------
2 // Design Name : parity_using_function2
3 // File Name : parity_using_function2.v
4 // Function : Parity using function
5 // Coder : Deepak Kumar Tala
6 //-----------------------------------------------------
7 module parity_using_function2 (
8 data_in , // 8 bit data in
9 parity_out // 1 bit parity out
10 );
11 output parity_out ;
12 input [7:0] data_in ;
13
14 wire parity_out ;
15 function parity;
16 input [31:0] data;
17 integer i;
18 begin
19 parity = 0;
20 for (i = 0; i < 32; i = i + 1) begin
21 parity = parity ^ data[i];
22 end
23 end
24 endfunction
25
26 always @ (data_in)
27 begin
28 parity_out = parity(data_in);
29 end
30
31 endmodule

1 //-----------------------------------------------------
2 // Design Name : parity_using_bitwise
3 // File Name : parity_using_bitwise.v
4 // Function : Parity using bitwise xor
5 // Coder : -
6 //-----------------------------------------------------
7 module parity_using_bitwise (
8 data_in , // 8 bit data in
9 parity_out // 1 bit parity out
10 );
11 output parity_out ;
12 input [7:0] data_in ;
13
14 assign parity_out = ^data_in;
15
16 endmodule
 

Related Articles

Chat Zalo