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




沒有留言:

張貼留言

WOKWI ESP32 LED Control , Node-Red MQTT SQLITE  

WOKWI ESP32 LED Control ,  Node-Red  MQTT SQLITE   const char broker[] = "test.mosquitto.org" ; //const char broker[] = "br...