add generator for write instruction