Mapping Opcodes to Binary
Your question is pretty vague. When you say how do you map an opcode to binary, are you asking about the assembler? The assembler would read your source code, parse the words "ADD AX1 BX2" into "011" and whatever the bitfields are for those two registers, and bump out a binary file. so something along the lines of:

strtok(p_buf," ",blah blah blah)
     if (strcmp(p_buf,"ADD")
         fprintf(objectocode_file,"011")
         strtok(p_buf," ",blah blah blah)
         if (strcmp(p_buf,"AX1")
              .........
    

An assembler is essentially just parsing your human written language, and rewriting it into the machine language, using the rules that were designed into it.

Or are you asking about the Instruction Register (IR) and Decoder? At the hardware level, Your CPU's Arithmetic and Logic Unit (ALU) is basically going to feed the operands (AX,BX,CX, et cetera) to logic functions for the various operations, and (again in very basic terms), demultiplex (or decode or switch or whatever word you use )the outputs of these various operations based on the OPCODE, so if you can imagine the outputs of the adder, subtractor, shift register, comparator, et cetera, all as inputs to DEMUX, the control input to which would be the OPCODE. In truth, the IR switches the operands on the inputs to the various logic functions as well.

This is all Microcomputer Architecture 101, and for more in depth details, any graduate or undergraduate level text should have all of this.