1) Design finite state diagram for a mod-4 up/ down counter (not a counter slice
ID: 3813990 • Letter: 1
Question
1) Design finite state diagram for a mod-4 up/ down counter (not a counter slice) with asynchronous active-low reset.
2) Non-return-to-zero inverted (NRZI) is a data coding scheme used to communicate with universal serial bus (USB) devices. The output signal (z) of an NRZI generator transitions when the input bit (x) is 0 and remains at the constant previous value (0 or 1) when the input bit is 1. That is, from right to left, when the input to the NRZI generator is 0 0 0 0 0 0, its output from right to left will transition as 1 0 1 0 1 0. Its output for consecutive 1’ s at the input, however, will remain at the previous output value. For example, the NRZI generator outputs from right to left z: 0 0 0 0 0 1 0 1 1 1 1 0 1 0 1 1 for input X: 1 1 1 1 0 0 0 1 1 1 0 0 0 0 1 1 read from right to left. Likewise, for X = 0xCF0C, Z: 0xEFAE. Design the finite state diagram for the NRZI generator.
Explanation / Answer
public category TTTConsoleNonOO2P cipher = 2;
// Name-constants to represent the varied states of the sport
public static final int enjoying = 0;
public static final int DRAW = 1;
public static final int CROSS_WON = 2;
public static final int NOUGHT_WON = 3;
// the sport board and also the game standing
public static final int ROWS = three, COLS = 3; // range of rows and columns
public static int[][] board = new int[ROWS][COLS]; // game board in 2nd array
// containing (EMPTY, CROSS, NOUGHT)
public static int currentState; // this state of the sport
// (PLAYING, DRAW, CROSS_WON, NOUGHT_WON)
public static int currentPlayer; // this player (CROSS or NOUGHT)
public static int currntRow, currentCol; // current seed's row and column
public static Scanner in = new Scanner(System.in); // the input Scanner
/** The entry main methodology (the program starts here) */
public static void main(String[] args) {
// Initialize the game-board and current standing
initGame();
// Play the sport once
do else if (isDraw())
// Otherwise, no amendment to currentState (still PLAYING).
}
/** come back true if it's a draw (no additional empty cell) */
// TODO: Shall declare draw if no player will "possibly" win
public static Boolean isDraw() mountain pass = 0; gap < COLS; ++col) {
if (board[row][col] == EMPTY) {
come back false; // AN empty cell found, not draw, exit
}
}
}
come back true; // no empty cell, it is a draw
}
/** come back true if the player with "theSeed" has won once inserting at
(currentRow, currentCol) */
public static Boolean hasWon(int theSeed, int currentRow, int currentCol) {
come back (board[currentRow][0] == theSeed // 3-in-the-row
&& board[currentRow][1] == theSeed
&& board[currentRow][2] == theSeed
|| board[0][currentCol] == theSeed // 3-in-the-column
&& board[1][currentCol] == theSeed
&& board[2][currentCol] == theSeed
|| currentRow == currentCol // 3-in-the-diagonal
&& board[0][0] == theSeed
&& board[1][1] == theSeed
&& board[2][2] == theSeed
|| currentRow + currentCol == two // 3-in-the-opposite-diagonal
&& board[0][2] == theSeed
&& board[1][1] == theSeed
&& board[2][0] == theSeed);
}
/** Print the sport board */
public static void printBoard() mountain pass = 0; gap < COLS; ++col) every of the cells
if (col != COLS - 1)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.