Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

OBJECTIVE: Model a \"O000111\" detector Moore Finite State Machine PROCEDURE: Fi

ID: 3735415 • Letter: O

Question

OBJECTIVE: Model a "O000111" detector Moore Finite State Machine PROCEDURE: First reference and understand the implementation of the "110" detector discussed in class. The Verilog implementation can be found at: https://www.edaplayground.com/x/3a20 1. Use the given state diagram below as a reference for modeling this detector S4 2. "Encode" each state by using a 3-bit binary equivalent of its index i.e. s4 is encoded as 100 3. Create a state table for this system 4. Use K-Maps to find next state equations for the DFFs and derive the output equation. 5. Convert the equations to logic gates and create a Verilog module using gate level primitives to model your design. (Use the DFF module named dffr.v which can be found in the project link at the beginning of this lab description.) Use the given Verilog skeleton module design.sv timescale 1ns/1ps 2 include "dffr.v" 3 module moore0000111 (input clk, x, reset, output [2:0] q, output z ; wire notx; 5 wire [2:0] notq, d; wire [11:0] w; 7 8 not 10 n1 (notq [O], q[o]), 11 n2 (notq[1], q1 12 n3 (notq[2], q[2]); 13 14//fi11 rest of module with gate level primitives from K-Map 15 16 7 endmodule

Explanation / Answer

Code:

        .section .mdebug.abi32

        .previous

        .nan    legacy

        .module fp=32

        .module nooddspreg

        .abicalls

        .rdata

        .align 2

$LC0:

        .ascii "Enter an alphabet: "

        .align 2

$LC1:

        .ascii "%c"

        .align 2

$LC2:

        .ascii "%c is a vowel."

        .align 2

$LC3:

        .ascii "%c is a consonant."

        .text

        .align 2

        .globl main

        .set    nomips16

        .set    nomicromips

        .ent    main

        .type   main, @function

main:

        .frame $fp,48,$31              # vars= 16, regs= 2/0, args= 16, gp= 8

        .mask   0xc0000000,-4

        .fmask 0x00000000,0

        .set    noreorder

        .cpload $25

        .set    nomacro

        addiu   $sp,$sp,-48

        sw      $31,44($sp)

        sw      $fp,40($sp)

        move    $fp,$sp

        .cprestore      16

        movz    $31,$31,$0

        lw      $2,%got($LC0)($28)

        nop

        addiu   $4,$2,%lo($LC0)

        lw      $2,%call16(printf)($28)

        nop

        move    $25,$2

        .reloc 1f,R_MIPS_JALR,printf

1:      jalr    $25

        nop

        lw      $28,16($fp)

        addiu   $2,$fp,32

        move    $5,$2

        lw      $2,%got($LC1)($28)

        nop

        addiu   $4,$2,%lo($LC1)

        lw      $2,%call16(__isoc99_scanf)($28)

        nop

        move    $25,$2

        .reloc 1f,R_MIPS_JALR,__isoc99_scanf

1:      jalr    $25

        nop

        lw      $28,16($fp)

        lb      $3,32($fp)

        li      $2,97                   # 0x61

        beq     $3,$2,$L2

        nop

        lb      $3,32($fp)

        li      $2,101                  # 0x65

        beq     $3,$2,$L2

        nop

        lb      $3,32($fp)

        li      $2,105                  # 0x69

        beq     $3,$2,$L2

        nop

        lb      $3,32($fp)

        li      $2,111                 # 0x6f

        beq     $3,$2,$L2

        nop

        lb      $3,32($fp)

        li      $2,117                  # 0x75

        bne     $3,$2,$L3

        nop

$L2:

        li      $2,1                    # 0x1

        b       $L4

        nop

$L3:

        move    $2,$0

$L4:

        sw      $2,24($fp)

        lb      $3,32($fp)

        li      $2,65                   # 0x41

        beq     $3,$2,$L5

        nop

        lb      $3,32($fp)

        li      $2,69                   # 0x45

        beq    $3,$2,$L5

        nop

        lb      $3,32($fp)

        li      $2,73                   # 0x49

        beq     $3,$2,$L5

        nop

        lb      $3,32($fp)

        li      $2,79                   # 0x4f

        beq     $3,$2,$L5

        nop

        lb      $3,32($fp)

        li      $2,85                   # 0x55

        bne     $3,$2,$L6

        nop

$L5:

        li      $2,1                    # 0x1

        b       $L7

        nop

$L6:

        move    $2,$0

$L7:

        sw      $2,28($fp)

        lw      $2,24($fp)

        nop

        bne     $2,$0,$L8

        nop

        lw      $2,28($fp)

        nop

        beq     $2,$0,$L9

        nop

$L8:

        lb      $2,32($fp)

        nop

        move    $5,$2

        lw      $2,%got($LC2)($28)

        nop

        addiu   $4,$2,%lo($LC2)

        lw      $2,%call16(printf)($28)

        nop

        move    $25,$2

        .reloc 1f,R_MIPS_JALR,printf

1:      jalr    $25

        nop

        lw      $28,16($fp)

        b       $L10

        nop

$L9:

        lb      $2,32($fp)

        nop

        move    $5,$2

        lw      $2,%got($LC3)($28)

        nop

        addiu   $4,$2,%lo($LC3)

        lw      $2,%call16(printf)($28)

        nop

        move    $25,$2

        .reloc 1f,R_MIPS_JALR,printf

1:      jalr    $25

        nop

        lw      $28,16($fp)

$L10:

        move    $2,$0

        move    $sp,$fp

        lw      $31,44($sp)

        lw      $fp,40($sp)

        addiu   $sp,$sp,48

        j       $31

      nop

        .set    macro

        .set    reorder

        .end    main

        .size   main, .-main

        .ident "GCC: