Verilog routine