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




沒有留言:

張貼留言

2026 作業3 RFID+ Telegram 練習

 2026 作業3  RFID+ Telegram  練習 (Wokwi 與 Telegram 二者溝通訊息反映比較慢 ) 歡迎 Alex 使用 RFID 控制系統 /on : 開啟 LED /off : 關閉 LED /flash : 閃爍模式 /timer : 開啟 5 秒 ...