Clean up memory initialization hack in verilator testbench
Some other refactoring and cleanup