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.
ANSWER(main module along with test bench)
/*
* Do not change Module name
*/
module mod(in1,out);
input[3:0] in1;
output reg out;
always@(in1)
begin
case(in1)
0,1,2,3,5,8,13: out<=1;
default: out<=0;
endcase
end
endmodule
module tb;
reg[3:0] rin1;
wire wout;
mod m1(rin1,wout);
initial
begin
rin1=4'd0;
#4 $display("output=%b when input 0",wout);
rin1=4'd1;
#4 $display("output=%b when input 1",wout);
rin1=4'd2;
#4 $display("output=%b when input 2",wout);
rin1=4'd3;
#4 $display("output=%b when input 3",wout);
rin1=4'd5;
#4 $display("output=%b when input 5",wout);
rin1=4'd8;
#4 $display("output=%b when input 8",wout);
rin1=4'd13;
#4 $display("output=%b when input 13",wout);
rin1=4'd12;
#4 $display("output=%b when input 12",wout);
end
endmodule
OUTPUT:
Fibonacci: case. Write a VHDL description for a circuit that accepts a four-bit input and outputs...
Design a combinational circuit design that given a four-bit number as the input outputs an 8-bit number that represents the nth Fibonacci number in the sequence. For instance, if the input is 0001, the output should be the second number in the Fibonacci sequence. The Fibonacci series looks like the following: 0, 1, 1, 2, 3, 5, 8, 13, and so on. The first two numbers in the sequence are always 0 and 1. However, after that, you must add...
Q4) Write a VHDL module that implements a combinational circuit that indicates the number of days in a given month. Notes: The month input is a single port (4-bit number). 'The Leap_Year port indicate if it is a leap year. The outputs must be 4 separate ports. Invalid months should result in no outputs active. Q4) Write a VHDL module that implements a combinational circuit that indicates the number of days in a given month. Notes: The month input is...
Design a combinational circuit that accepts a 3-bit binary number input x and generates a 6-bit binary number output equal to the xth Fibonacci number F(x) = F(x-1) +F(x-2) where F(0) = 2 and F(1) = 3.The book we are using in class is this: http://www.cramster.com/logic-and-computer-design-fundamentals-4th-solutions-3631 and we are on chapter 3.
4. Design a 4-bit Adder / Subtractor. Follow the steps given below. (a) Write the VHDL code for a 1-bit Full Adder. The VHDL code must include an entity and an architecture. (b) Draw the circuit diagram for a 4-bit Adder / Subtractor. The circuit diagram may include the following logic elements: 1-bit Full Adders (shown as a block with inputs and outputs) Any 2-input logic gates Multiplexers Do not draw the logic circuit for the 1-bit Full Adder.
Write a VHDL module that implements a combinational dircuit that indicates the number of days in a given month. Notes: Q4) .. The month input is a single port (4-bit number The Leap Year port indicate if it is a leap yeat . The outputs must be 4 separate ports .Invalid months shouid result in no outputs active. (5 marks) di 1緋 VHDL code paste here using fixed-uidth gth Fonr e consolas Et must be formanted and indented correstty otherwise...
Exercises: 1. Write the VHDL statements to describe a 4-bit comparator. Use the appropriate relational operators. Use input ports A and B, described above, as the inputs to the 4-bit comparator. Assume that three output ports, EQ, GT, and LT, have been declared in the Entity statement. Use them as the outputs from the comparator 2. Identify the package (or packages) that must be included in your VHDL code in order to use the relational operators with signals of type...
6. Write a VHDL code to implement the circuit function described below. The circuit is to display the last four digits of your student ID number on a 7-segment display, one digit at a time, triggered by the falling edge of the clock signal DIR: Direction of the display sequence, '1'forward, '0'- reverse. CLK: clock pulse for the display sequence. RST: reset the display counter Student ID-8860729 Vdd ABC|DEFG DIR CLK RST For example, if your ID number is 1234567,...
Write a VHDL code to implement the circuit function described below. 6. The circuit is to display the last four digits of your student ID number on a 7-segment display, one digit at a time, triggered by the falling edge of the clock signal. DIR: Direction of the display sequence, '1 CLK: clock pulse for the display sequence RST: reset the display counter. forward, '0' - reverse. Student ID: 8480594 Vdd ABCDE F G DIR CLK RST For example, if...
Write a VHDL code to implement the circuit function described below. 6. The circuit is to display the last four digits of your student ID number on a 7-segment display, one digit at a time, triggered by the falling edge of the clock signal. DIR: Direction of the display sequence, '1 CLK: clock pulse for the display sequence RST: reset the display counter. forward, '0' - reverse. Student ID: 8243416 Vdd ABCDE F G DIR CLK RST For example, if...
Write an ARM assembly language subroutine (named nfibo) to calculate and return the n-th Fibonacci number. Fibonacci numbers (or a Fibonacci sequence) are a series of numbers with a property that the next number in the series is a sum of previous two numbers. Starting the series from 0, 1 as the first two numbers we have 0, 1, (0 + 1) = 1, (1 + 1) = 2, (1 + 2) = 3, (2 + 3) = 5, (3...