library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity model is
port ( clk, rst : in
std_logic;
cntrl
: in std_logic_vector(1 downto 0);
out1, out2 : out
std_logic_vector(3 downto 0)
);
end model;
architecture arch of model is
signal reg1, reg2 : std_logic_vector(3 downto 0);
begin
process (clk, rst)
begin
if (rst = '1') then
reg1 <= "0000";
reg2 <= "0000";
else
if rising_edge(clk) then
case (cntrl)
is
when "00"=> reg1 <= reg1 +
reg2;
reg2 <=
reg2 - 1;
when "01"=> reg1 <= reg1 -
reg2;
reg2 <=
reg2 - 1;
when "10"=> reg1 <= reg1 +
1;
reg2 <=
reg2 - 1;
when "11"=> reg1 <= reg1 -
1;
reg2 <=
reg2 - 1;
when others=> null;
end case;
end if;
end if;
out1 <= reg1;
out2 <= reg2;
end process;
end arch;
----------------------------------------------
Pro blem 2 VHDL Coding complete the following VHDL model for the given logic diagram by writing a...
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.
(20 pts)VHDL. Implement the logic circuit specified in the following truth table by using a 4:1 mulitiplexer ome regular logic gates. 11 Draw a schematic of your implementation. 2) Suppose that you are given the following VHDL code of a 4:1 multiplexer. Please write a VHDL code to describe your implementation by using structure modeling technique, by using the following 4:1 multiplexer asia your answer component in your structure modeling. Note that you do not need to re-write the following...
2. (a) Name and give a short description of the four design styles for describing a logic function in an architecture? (b) List three concurrent signal assignment statements (c) The following two VHDL codes (architecture part) desanbe the logic diagram shown in Fig 1 (c) using different design styles. Discuss in detail the design style used for each description. begin My-Proc process (DOD 02 architecture architecture 1 of Entity 1 is Signal or out:std logie begin begin (IDO or D1...
QUESTION 1 Complete the following peice of VHDL code with the necessary VHDL statements for a counter that counts through this sequence(0,9,17,15,4,26) repeatedly. library IEEE use IEEE.STD_LOGIC_1164 ALL entity GCC is Port ( systemClock, reset in STD_LOGIC end GCC architecture Behavioral of GCC is stateOutput out STD LOGIC_ VECTOR (4 downto 0)) component FreqDivider is Port (systemClock in STD_LOGIC; slowClock: out STD LOGIC); end component, signal nextState, presentState: std_logic_vector(5 downto 0) := "00000"; signal slowClock: std_logic begin FD0: FreqDivider port...
VIVA QUESTIONS: 1. Implement the following function using VHDL coding. (Try to minimize if you can). F(A,B,C,D)=(A'+B+C). (A+B'+D'). (B+C'+D') . (A+B+C+D) 2. What will be the no. of rows in the truth table of N variables? 3. What are the advantages of VHDL? 4. Design Ex-OR gate using behavioral model? 5. Implement the following function using VHDL code f=AB+CD. 6. What are the differences between half adder and full adder? 7. What are the advantages of minimizing the logical expressions?...
.For the following circuit, do: RR3R2R, Ro G G3G2G,Go Write structural VHDL code. Create two files: i) flip flop, ii) top file (where you will interconnect the flip flops and the logic gates). Provide a printout. (10 pts) Write a VHDL testbench according to the timing diagram shown below. Complete the timing diagram by simulating your circuit (Behavioral Simulation). The clock frequency must be 100 MHz with 50% duty cycle. Provide a printout. (15 pts) Ro R1 R2 Ro resetn...
DOING NUMBER 7 of VHDL lab "write your own full-adder in
VHDL " is my only request. Do the rest, if you have
time.
To verify and apply techniques to build half adders and full adder to perform additions using gates. For each part of the procedure, show the number of that section and include a logic diagram of the circuit, truth table for the circuit, and any other necessary information. Adder Implementation 1. Construct a binary half-adder and record...
8.(5 points).There is an error in following VHDL code. Find the error and correct (only that line of code). LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY dec2to4 IS PORT (i IN STD LOGIC VECTOR (1 DOWNTO 0); : En IN STD_LOGIC; d OUT STD LOGIC); END dec2to4; ARCHITECTURE dataflow OF dec2to4 IS BEGIN SIGNAL Eni: STD_LOGIC_VECTOR(2 DOWNTO 0); Eni <= En & i; -concatenate signals WITH Eni SELECT d <"0001" WHEN "100" "0010" WHEN "101", "0100" WHEN "110", "1000" WHEN "111", 0000"...
Write the following program to be executed on the FPGA board. 1. Write a VHDL model for a code detector as shown in the Figure. The keypad is used to unlock a door. Pressing the start button followed by the sequence red-green-red-blue unlocks the door, no other sequence can open the door. Assume the clock is slowed down and each pressing of a button is detected once. For example when red is pressed it is only detected as pressed for...
Derive the logic gates for a 2-bit Arithmetic Logic Unit (ALU)
with four micro-operations:
1) Complete the table below by showing the select input bits and the necessary groupings. (5 points) Select Inputs Micro-Operation Description F = A-B-1 F = A + B +1 F = AVB F = ashl A Subtraction with borrow Addition with carry Logic OR Arithmetic shift left 2) Draw a detailed logic circuit of the ALU's arithmetic unit. (10 points) 3) Draw a detailed logic...