2021年4月22日 星期四

HBLbits_Verilog Basic_Reduction

HBLbits_Verilog Basic_Reduction 

 bitwise operations between two values, e.g., a & b or a ^ b

The reduction operators can do AND, OR, and XOR of the bits of a vector, producing one bit of output:

& a[3:0]     // AND: a[3]&a[2]&a[1]&a[0]. Equivalent to (a[3:0] == 4'hf)
| b[3:0]     // OR:  b[3]|b[2]|b[1]|b[0]. Equivalent to (b[3:0] != 4'h0)
^ c[2:0]     // XOR: c[2]^c[1]^c[0]


Parity checking is often used as a simple method of detecting errors when transmitting data through an imperfect channel.

module top_module (
    input [7:0] in,
    output parity); 
    
    assign parity= ^in[7:0];
endmodule




沒有留言:

張貼留言

設定並測試 Flutter

  設定並測試 Flutter https://docs.flutter.dev/install/quick 使用基於開源軟體的編輯器(例如 VS Code)在您的裝置上安裝 Flutter,即可開始使用 Flutter 開發您的第一個多平台應用程式! 學習如何使用任何基於開源軟...