Digital Logic Example

Design of a state machine

Design a finite state machine and associated sequential circuit with a single input and a single output that outputs a 1, if the last three inputs were 101.

Design the circuit as both a Mealy and Moore machine.

Design of a data path

Study a data path and associated control circuit to work on the Collatz conjecture. The data path and control circuit should mimic the following C program.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
    int count, num ;
    puts("Enter a number") ;
    scanf("%d", &num) ;
    count = 0 ;
    while (num != 1) {
        printf("%8d\n", num) ;
        if (num%2==0) {
            num = num/2 ;
        } else {
            num = 3*num + 1 ;
        }
        ++count ;
    }
    printf("%8d\n\n", num) ;
    printf("iterations: %d\n", count) ;
    
    return (EXIT_SUCCESS);
}