rtl: replace open-coded block rams with a generic version.

This gets repeated everywhere so create a generic block ram with write
bypassing.
rtl/cache: convert valid memory to a block ram.
rtl/cache: convert cache memory to block ram.