Bases and digital circuits
2022-03-17T02:44:53.030505
Another post in the "trying to keep my DSP memory fresh" series.
- logarthmic base 2; binary digits; bits - a device with two stable positions (relay or flip/flop) can store one bit of information. N such devices can store N bits.
- logarthmic base 10; decimal digits - 1 decimal digit is about 3 1/3 bits; a device with 10 stable positions stores one decimal digit.
- logarthimic base e; natural units - useful for integration and differentiation
- change from base a to base b requires multiplying by log (base b) a
- the entropy for a signal character message using the alphabet (a-z) is = log base 2 * 26 = 4.7
digital circuits
fn half_adder(x: bool, y: bool) -> (bool,bool) {
let sum = x&y;
let carry = x^y;
(sum, carry)
}
fn full_adder(x: bool, y: bool, c: bool) -> (bool, bool) {
let (a, b) = half_adder(x, y);
let (j, k) = half_adder(b, c);
let sum = a || j;
let carry = k;
(sum,carry)
}
fn bitwise_addition(x: u8, y: u8) -> u8 {
if y == 0 { x } else { add(x^y, (x&y) << 1 ) }
}