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




沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...