CS3724 Assignment 10

Questions and Answers

Question 1. [ 25 ]

Draw the circuit for a dual write, dual read register file with three 16-bit registers. You can use high level components like multiplexers, selectors, decoders, and 16-bit registers. The register file must have two 16-bit data inputs, two 2-bit select lines for the write inputs, two 16-bit register outputs with two 2-bit read select lines. A value of 11 on the select lines should select no registers for reading or writing.

Question 2. [ 25 ]

Draw the circuit that includes an ALU and a block diagram of the register file (outline with only inputs and outputs labeled) from the first questions that show the ALU and register file configuration for a circuit that implements the following instructions:

Use a table to show the configuration for the register file and ALU select inputs for each instruction.

Question 3. [ 25 ]

Hand assemble the following Y86 program. Your hand assembly should contain the instructions and data encoding in hexadecimal with the matching assembler statement.

hand1.ys

        .pos 0
start:  irmovl  $0x1000, %esp
        xorl    %edi, %edi
        xorl    %esi, %esi
        irmovl  $10, %edx
loop:   mrmovl  iii(%esi), %eax
        pushl   %eax
        mrmovl  jjj(%esi), %eax
        pushl   %eax
        call    sum
        addl    %eax, %edi
        irmovl  $1, %eax
        subl    %eax, %edx
        jne     loop
        halt
sum:    pushl   %ebp
        rrmovl  %esp, %ebp
        pushl   %ebx
        mrmovl  8(%ebp), %eax
        mrmovl  12(%ebp), %ebx
        addl    %ebx, %eax
        popl    %ebx
        rrmovl  %ebp, %esp
        popl    %ebp
        ret
        .align 4
iii:    .long 47
jjj:    .long 0x12345678

The assembled file is

hand1.yo

  0x000:              |         .pos 0
  0x000: 308400100000 | start:  irmovl  $0x1000, %esp
  0x006: 6377         |         xorl    %edi, %edi
  0x008: 6366         |         xorl    %esi, %esi
  0x00a: 30820a000000 |         irmovl  $10, %edx
  0x010: 500650000000 | loop:   mrmovl  iii(%esi), %eax
  0x016: a008         |         pushl   %eax
  0x018: 500654000000 |         mrmovl  jjj(%esi), %eax
  0x01e: a008         |         pushl   %eax
  0x020: 8035000000   |         call    sum
  0x025: 6007         |         addl    %eax, %edi
  0x027: 308001000000 |         irmovl  $1, %eax
  0x02d: 6102         |         subl    %eax, %edx
  0x02f: 7410000000   |         jne     loop
  0x034: 10           |         halt
  0x035: a058         | sum:    pushl   %ebp
  0x037: 2045         |         rrmovl  %esp, %ebp
  0x039: a038         |         pushl   %ebx
  0x03b: 500508000000 |         mrmovl  8(%ebp), %eax
  0x041: 50350c000000 |         mrmovl  12(%ebp), %ebx
  0x047: 6030         |         addl    %ebx, %eax
  0x049: b038         |         popl    %ebx
  0x04b: 2054         |         rrmovl  %ebp, %esp
  0x04d: b058         |         popl    %ebp
  0x04f: 90           |         ret
  0x050:              |         .align 4
  0x050: 2f000000     | iii:    .long 47
  0x054: 78563412     | jjj:    .long 0x12345678
Question 4. [ 25 ]

Disassemble the following memory dump into Y86 assembly code. The memory dump contains both data and instructions.

dis1.yo

  0x200:              
  0x200: 308104000000 
  0x206: 3087d00f0000 
  0x20c: 6300         
  0x20e: 308210000000 
  0x214: 503700000000 
  0x21a: 6030         
  0x21c: 6017         
  0x21e: 6112         
  0x220: 7614020000   
  0x225: 00           
  0x226: 10           
                      
  0xfd0:              
  0xfd0: efbeadde     
  0xfd4: 0ff00000     
  0xfd8: 020100ff     
  0xfdc: 03020100     

The assembler source is

dis1.ys

        .pos 0x200
        irmovl  4, %ecx
        irmovl  $array, %edi
        xorl    %eax, %eax
        irmovl  $16, %edx
loop:   mrmovl  (%edi), %ebx
        addl    %ebx, %eax
        addl    %ecx, %edi
        subl    %ecx, %edx
        jg      loop
        nop
        halt
        .pos 0xfd0
array:  .long 0xdeadbeef
        .long 0xf00f
        .long 0xff000102
        .long 0x00010203