Write a Verilog program that tests whether a 4-bit input variable is a Fibonacci number or not. Please attach your Verilog code to your submission. Also include a screenshot of your Verilog code, as well as your program execution result as an answer to this question.
Answer 1)
Truth Table for the fibbonacci circuit is mentioned below:-
Verilog Code:-
// Fibonacci series upto 4 bits is ::: 0 1 2 3 5 8 13
module FibCircuit (A3, A2, A1, A0, Y);
input A3, A2, A1, A0;
output reg Y;
always @(A3, A2, A1, A0)
begin
case ({A3, A2, A1, A0})
4'd0 : Y = 1'b1;
4'd1 : Y = 1'b1;
4'd2 : Y = 1'b1;
4'd3 : Y = 1'b1;
4'd4 : Y = 1'b0;
4'd5 : Y = 1'b1;
4'd6 : Y = 1'b0;
4'd7 : Y = 1'b0;
4'd8 : Y = 1'b1;
4'd9 : Y = 1'b0;
4'd10 : Y = 1'b0;
4'd11 : Y = 1'b0;
4'd12 : Y = 1'b0;
4'd13 : Y = 1'b1;
4'd14 : Y = 1'b0;
4'd15 : Y = 1'b0;
default : Y = 1'b0;
endcase
end
endmodule
TESTBENCH:-
module FibCircuit_tb;
reg A3, A2, A1, A0;
wire Y;
integer i;
FibCircuit DUT (.A3(A3), .A2(A2), .A1(A1), .A0(A0), .Y(Y));
initial
begin
$monitor("A3 = %d, A2 = %d, A1 = %d, A0 = %d, Y = %d", A3, A2, A1,
A0, Y);
for (i = 0; i < 16; i = i + 1) begin
{A3, A2, A1, A0} = i ; #10;
end
end
endmodule
/************ Output of Program ******************
A3 = 0, A2 = 0, A1 = 0, A0 = 0, Y = 1
A3 = 0, A2 = 0, A1 = 0, A0 = 1, Y = 1
A3 = 0, A2 = 0, A1 = 1, A0 = 0, Y = 1
A3 = 0, A2 = 0, A1 = 1, A0 = 1, Y = 1
A3 = 0, A2 = 1, A1 = 0, A0 = 0, Y = 0
A3 = 0, A2 = 1, A1 = 0, A0 = 1, Y = 1
A3 = 0, A2 = 1, A1 = 1, A0 = 0, Y = 0
A3 = 0, A2 = 1, A1 = 1, A0 = 1, Y = 0
A3 = 1, A2 = 0, A1 = 0, A0 = 0, Y = 1
A3 = 1, A2 = 0, A1 = 0, A0 = 1, Y = 0
A3 = 1, A2 = 0, A1 = 1, A0 = 0, Y = 0
A3 = 1, A2 = 0, A1 = 1, A0 = 1, Y = 0
A3 = 1, A2 = 1, A1 = 0, A0 = 0, Y = 0
A3 = 1, A2 = 1, A1 = 0, A0 = 1, Y = 1
A3 = 1, A2 = 1, A1 = 1, A0 = 0, Y = 0
A3 = 1, A2 = 1, A1 = 1, A0 = 1, Y = 0
**********************************************/
Write a Verilog program that tests whether a 4-bit input variable is a Fibonacci number or...
32-bit Multiplier program in verilog Write a Verilog program that simulates a 32-bit binary multiplier. Please comment as many lines as possible for comprehension and make use of loops in verilog to make the code simpler. Thank you. I will give good rating if correct. Note that most online code is not specifically made for 32 bit multipliers. must run in online verilog compilers such as tutorialspoint verilog compiler. thanks
write a verilog code that takes binary 4-bit input and convert to bcd 4bit output (4 outputs each 4 bit)
Write a program in MIPs Assembly Language to compute nth number of a fibonacci number sequence. Your program should prompt for an integer input n from the user. The program should call a recursive function to compute the nth fibonacci number. Your program must follow programming convention. You should submit program and screenshot of output in a single word/pdf file. You should use following recursive definition of fibonacci function: fib(0) = 0 fib(1) = 1 fib(n) = fib(n-1) +fib(n-2)
Your
program write
a program to test whether a number is prime or not.
Your program should
ask user to input an integer and respond: "Prime" or "Not
prime".
Don't use any
library function that tests for prime numbers.
The program should
continue to ask for input, till it sees a 0, when it exits.
Please submit printed
pseudocodeshould ask user to input an
integer and respond: "Prime" or "Not prime".
Don't use any library function that tests for prime numbers....
Use as few 3-input NOR gates as possible to design a bubble detector circuit for 8-bit thermometer code. An n-bit thermometer code represents an integer m, with m 1s followed by (n-m) 0s. 1-bit bubble is an error in coding when a solitary 0 (or 1) is found in between two 1s (or 0s). What is the size of your circuit in terms of the number of NOR gates used? Give a gate level schematic diagram for your circuit. Implement...
Question 3 Program Language C++
Problem 3 Fibonacci Numbers 10 points Fibonacci numbers are a sequence of numbers where each number is represented by the sum of the two preceding numbers, starting with 0 and 1: 0, 1, 1, 2, 3, 5, 8, etc Write a program that repeatedly prompts the user for a positive integer and prints out whether or not that integer is a Fibonacci number. The program terminates when-I is entered. Create a method with the following...
Fibonacci: case. Write a VHDL description for a circuit that accepts a four-bit input and outputs true if the input is a Fibonacci number (0, 1, 2, 3, 5, 8, or 13). Your implementation must be done via a case statement.
ARM assembly language Write a program "fibonacci.s" that computes the Nth Fibonacci number where N is not so large that overflow of integer arithmetic is a concern. When your assembly language program is called it should expect the value of N to be passed using register r0 and your program should return the Nth Fibonacci number in register r0. Please include comments as well. Do not just use the output generated by gcc -S
Write a program that computes the Fibonacci number for some input integer. (See segments 7.37 – 7.41 in your book for some info on the Fibonacci sequence or you can look it up on the Internet). The sequence is defined as the first two elements are each 1, after that each element in the sequence is the sum of the previous two elements. The first few numbers of the sequence are 1,1,2,3,5,8,13,21,34,55,… Your assignment is to write a program with...
please explain
Question 3 1. Write behavioral Verilog code to calculate the factorial of a 3-bit unsigned number. (10 points) 2. Implement the following function using two 3-input-output lookup tables: f = a'be + acid. (10 points)