Reducing program size is a critical issue in many embedded systems which require more functionalities without increasing the memory size. One of the approaches is to adopt a mixed-width instruction set architecture (ISA) which usually has an instruction set in general formats (usually 32-bit long) as normal instruction set and an instruction set in shorter format (usually 16-bit long) with limited opcodes and set of registers. Traditionally, a code segment can be encoded in only one format, no multiple formats interleaved. However, more and more processors use instruction encoding to indicate the length of each individual instruction and take mixed-width ISA into instruction-level granularity. For this kind of ISAs, the number of instructions can be encoded in shorter format is highly dependent on the limited set of registers that can be accessed by shorter format instructions. In this paper, we present a register allocation and assignment algorithm based on graph coloring, which uses a heuristic model to find out which virtual variables in program should be assigned into the set of registers accessible by shorter instructions. The simulation results show that 63.34% of the instructions can be translated into shorter format on average.