Question

2) Create the logical right shift circuit in VHDL. Using the & operator for concatenation might...

2) Create the logical right shift circuit in VHDL. Using the & operator for concatenation might make things easier. For example, if A is a 4 bit input, the number “0”&A(3 downto 1) is A shifted one place right. The & operator sticks a zero onto the three most significant bits of A, A(3 downto 1). A(0) is lost, as expected. You must use std_logic_vectors with the & operator. “0” is a one bit std_logic_vector. A(3 downto 3) is also a one bit std_logic_vector.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use work.DigEng.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity core is
    Generic (
           N : INTEGER);
    Port ( CLK : in  STD_LOGIC;
           A, B, X : in  STD_LOGIC_VECTOR(N downto 0);
              OPERATION : in STD_LOGIC_VECTOR(3 downto 0); --Allows us up to 16 operations
              FLAGS : in STD_LOGIC_VECTOR(7 downto 0);
           ALU_OUTPUT : out  STD_LOGIC_VECTOR(N downto 0));
end core;

architecture Behavioral of core is
    signal TEMP_OUTPUT : STD_LOGIC_VECTOR(N downto 0);
begin
    TEMP_OUTPUT <= (A) WHEN OPERATION = "0000" ELSE
                --Bit-wise Logic
                 (A AND B) WHEN OPERATION = "0001" ELSE
                 (A OR B) WHEN OPERATION = "0010" ELSE
                 (A XOR B) WHEN OPERATION = "0011" ELSE
                 (NOT A) WHEN OPERATION = "0100" ELSE
                --Arithmetic
                 STD_LOGIC_VECTOR(SIGNED(A) + 1) WHEN OPERATION = "0101" ELSE
                 STD_LOGIC_VECTOR(SIGNED(A) - 1) WHEN OPERATION = "0110" ELSE
                 STD_LOGIC_VECTOR(SIGNED(A) + SIGNED(B)) WHEN OPERATION = "0111" ELSE
                 STD_LOGIC_VECTOR(SIGNED(A) - SIGNED(B)) WHEN OPERATION = "1000" ELSE
                --Shift
                 --(A <= X(N) & X(N downto 1)) WHEN OPERATION = "1001" ELSE
                 "1111";

end Behavioral;
Add a comment
Know the answer?
Add Answer to:
2) Create the logical right shift circuit in VHDL. Using the & operator for concatenation might...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a VHDL code using processes for the following logic circuit which include a shift register...

    Write a VHDL code using processes for the following logic circuit which include a shift register and 4x1 multiplexer. Use the entity below.              entity registers_min_max is port( din   : in std_logic_vector(3 downto 0);       reset : in std_logic;       clk   : in std_logic;       sel   : in std_logic_vector(1 downto 0);       reg_out : out std_logic_vector(3 downto 0)); end registers_min_max; din reset RO clk reset R1 A C clk reset R2 clk reset R3 clk 3 0 sel LE

  • 2. Serial shift registers Draw missing connections to implement various shift registers 1. Shift right: All...

    2. Serial shift registers Draw missing connections to implement various shift registers 1. Shift right: All bits of the register move right by one position, and a new bit value from a serial input is stored in the most significant bit (leftmost flip-flop below). Serial input -02 az 02 a Do ao Serial indino 2. Shift left: All bits of the register move left by one position, and a new bit value from a serial input is stored in the...

  • For this problem you will design a circular bit shifter in VHDL. These circuits are especially...

    For this problem you will design a circular bit shifter in VHDL. These circuits are especially useful for aligning signals in communications equipment. Your bit shifter should have a 4-bit input, a 4-bit output, and a 2-bit shift amount. The shift amount will specify how many bits are to be shifted, 0, 1, 2, or 3 bits. To perform a circular shift, take the N least significant bits, and put them in the most significant position. For example, 1010 shifted...

  • (15 points) Your colleague is trying to code a VHDL model for a 7419 register. Review...

    (15 points) Your colleague is trying to code a VHDL model for a 7419 register. Review the code on the next page and make any and all correction correct working model. Note the function model. Note the function table and additional information regarding need to solve this problem. DL model for a 74194 4-bit bidirectional universal shift tions that are necessary to produce a al information regarding the problem that you Control Signals Mode CirN SI SO Outputs 1 1...

  • Write VHDL code for: Part Ta: To Create a Clock Pre-Scaling Entity that Generates a Slow...

    Write VHDL code for: Part Ta: To Create a Clock Pre-Scaling Entity that Generates a Slow Clock Pulse Train from a Fast Clock Pulse Train: Obiective Create a Clock Pre-Scaling ENTITY called, PreScale, with one-bit input and 1-bit output The circuit is a 20-bit binary up-counter. Should roll back to zero once the max value is reached The MSB of the counter is connected to the output You may find it useful to refer to your code in Lab5 as...

  • PRG255 3.2 (2 marks) Write a C program that uses the bitwise shift operators to shut...

    PRG255 3.2 (2 marks) Write a C program that uses the bitwise shift operators to shut the The program will ask the user to enter an unsigned also how many bits for the shift operation. Display the entered operation in both decimal and binary formats, vise shirt operators to shift the bits to the right >> or the left << user to enter an unsigned integer number, choose right shift or left shift, and orauon. Display the entered number and...

  • Using Structural Modeling in VHDL write the code for: An Arithmetic Logic Unit (ALU) shown in...

    Using Structural Modeling in VHDL write the code for: An Arithmetic Logic Unit (ALU) shown in the figure below. A (16-bit), B (16-bit), Opcode (3-bit), and Mode (1-bit) are the inputs; and ALUOut (16-bit) and Cout (1-bit) are the outputs of the design. A and B hold the values of the operands. Mode and Opcode together indicate the type of the operation performed by ALU. The ALU components ARE: -Arithmetic Unit that consists of one 16-bit adder, 16-bit subtractor, 16-bit...

  • FIRST ACTIVITY: (100/100) . SIMPLE 4-BIT ARITHMETIC LOGIC UNIT (ALU): This circuit selects between arithmetic (absolute...

    FIRST ACTIVITY: (100/100) . SIMPLE 4-BIT ARITHMETIC LOGIC UNIT (ALU): This circuit selects between arithmetic (absolute value, addition) and logical (XOR, AND) operations. Only one result (hexadecimal value) can be shown on the 7-segment display This is selected by the input sel (1..0) B A-BI A+B A xnor B A nand B Input EN: If EN-1result appears on the 7 segment display. If EN=0 → all LEDs in the 7 segment display are off Arithmetic operations: The 4-bit inputs A...

  • Some questions may require well bulum 1. HDL stands for? a. Hardware Design Language b. Hardware...

    Some questions may require well bulum 1. HDL stands for? a. Hardware Design Language b. Hardware Development Language c. Hardware Description language d. Hot Dry Land 2. What is the basic building unit of a VHDL design? a. Blocks b. Cubes c . Dices d. Bricks 3. What reserved word do all VHDL entities end with? a. entity b. use c. port d. end d. IEEE 4. Which block describes a design's interface? a. entity b. architecture c. library 5....

  • please type the answer....No Hand writting please Two types of digital-to-analog modulation techniques are Amplitude Shift...

    please type the answer....No Hand writting please Two types of digital-to-analog modulation techniques are Amplitude Shift Keying (ASK) and Frequency Shift Keying (FSK). In ASK, two different amplitudes, and only two, represent the digital information. In FSK, only two different frequencies are used to represent the digital data. The Goal The goal of the design project is to design a Commsim circuit that will generate the following analog carrier based on a digital input stream: Output 2 0 -1 -2...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT