A write enable (W or WE) is the master switch for writing. In a register file, it is ANDed with every line of the write-address decoder to form the registers' load enables:
Lᵢ = W AND (address = i)
- W = 1: at the next edge, the addressed register loads the write data.
- W = 0: every load enable is 0, so every register holds.
Why it is needed: the write address and data lines always carry some value. Without W, the decoder would raise one load enable at every edge and overwrite a register every cycle. W lets the control unit write only during instructions that produce a result, such as ADD, and not during stores or branches.
It can be active-low (writing happens when W = 0), in which case the decoder lines are ANDed with instead.
If W is stuck at 1 by a fault, the addressed register is overwritten at every edge with whatever is on the data lines.
Memory chips use the same idea, with a write-enable pin that decides whether an access reads or writes; the memory topic covers those memory control signals.