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




沒有留言:

張貼留言

Telegram +ESP32自動發報機

  Telegram   +ESP32自動發報機 這套系統是一個典型的 IoT(物聯網)架構 ,結合了遠端配置(Python)、通訊中介(MQTT)與硬體執行(ESP32)。 以下我為您拆解這兩支程式的核心運作原理: 一、 系統架構流程 Python 端 (控制台) :使用者輸入...