Question

In: Electrical Engineering

PWrite a VHDL function that accepts a vector of arbitrary length and integer that specifies the...

PWrite a VHDL function that accepts a vector of arbitrary length and integer that specifies the number of bits the input vector to be rotated to the left and returns another vector. For instance functions accepts two inputs: 0101011 and 3 and it returns 1011010.

Solutions

Expert Solution

library ieee;
use ieee.std_logic_1164.all;
use IEEE.NUMERIC_STD.all;

entity vec_function is
   generic ( N   : integer := 6);
   port (   din   : in std_logic_vector(N-1 downto 0);
       rotate   : in integer;
       dout   : out std_logic_vector(N-1 downto 0)
   );
end vec_function;

architecture arch of vec_function is

begin

   dout <= (din ((N - 1) - rotate downto 0) & din((N - 1) downto (N - rotate)));

end arch;
      

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

--Simulated on ModelSim


Related Solutions

R programming language A) Create a function that accepts two arguments, an integer and a vector...
R programming language A) Create a function that accepts two arguments, an integer and a vector of integers. It returns the count of the number of occurrences of the integer in the input vector. 1]Input: num_count <-function ??? 2]Input: num_count(2,c(1,1,2,2,3,3)) 2] Output: 2 3] Input: num_count(1,c(1,1,2,2,3,1,4,5,5,2,2,1,3)) 3] Output : 4 B) Create a function that accepts 3 integer values and returns their sum. However, if an integer value is evenly divisible by 3, then it does not count towards the...
Using C++ Write a template function that accepts an integer parameter and returns its integer square...
Using C++ Write a template function that accepts an integer parameter and returns its integer square root. The function should return -1, if the argument passed is not integer. Demonstrate the function with a suitable driver program .
Write a function, named isMultipleOfFive that accepts integer argument. When the function is called, it should...
Write a function, named isMultipleOfFive that accepts integer argument. When the function is called, it should display if the argument "is a multiple of 5" or "is not a multiple of 5".
Write a function called ReturnOddEntries.m that accepts as input a column or row array (vector) and...
Write a function called ReturnOddEntries.m that accepts as input a column or row array (vector) and returns only the odd index entries. Do this by first setting the even entries to 0, and then removing the 0 entries by using a logical array. The first line of your code should read function p = ReturnOddEntries(p) For example, if you run in the command window p = ReturnOddEntries([1.2 7.1 8.4 -42 100.1 7 -2 4 6]), then you should get p...
Python: Write a function named calc_odd_sum that accepts a positive integer as the argument and returns...
Python: Write a function named calc_odd_sum that accepts a positive integer as the argument and returns the sum of all the odd numbers that are less than or equal to the input number. The function should return 0 if the number is not positive. For example, if 15 is passed as argument to the function, the function should return the result of 1+3+5+7+9+11+13+15. If -10 is passes, it shall return 0. You shall run the program test the result at...
Write 2 MATLAB functions. One called exptrig which takes a vector of arbitrary length, x, containing...
Write 2 MATLAB functions. One called exptrig which takes a vector of arbitrary length, x, containing any real numbers, and computes the mathematical function f(x) = 3e^(-x)(cos^2(5x) - sin^2(5x)). The other one will be called trigsum, which takes a vector arbitrary length, x, containing any real numbers, and computes the mathematical function g(x)= ((sin(10x) + cos(10x))/ 2) + 3. Both functions will be computed at each of the values of x, and internally will output these values into a vector,...
Write a MATLAB function that accepts input vector x and returns the number of local maximums...
Write a MATLAB function that accepts input vector x and returns the number of local maximums of x with value between xmin and xmax. Ask user to input values xmin and xmax at the beginning of the procedure. Use vector x (the vector x from that file consists of 1000 numbers ranging from 0.0044 to 0.67).
Write a function that takes a numeric or integer vector and adds up only the numbers...
Write a function that takes a numeric or integer vector and adds up only the numbers whose integer parts are even. Modify your answer to question above to include an option that allows you to choose whether to sum numbers whose integer parts are even or are odd. Your function should have as a default that it gives the same output as the function in question 4. In other words, if the user doesn’t specify whether to sum evens or...
Write a python function that accepts two integer values corresponding to the point (x, y). Check...
Write a python function that accepts two integer values corresponding to the point (x, y). Check whether the point is within the rectangle centered at (0, 0) with width 20 and height 15. For example, (-9, 7) is inside the rectangle and (11, 4) is outside the rectangle, as shown in the figure. Return True if the point falls within the rectangle and False otherwise
Write the following function taking in an integer vector (vector &prices) consisting of all prices, in chronological order, for an hypothetical instrument.
/** * FUNCTION SIGNATURE: * PURPOSE: * PARAMETER: * RETURN VALUE: * Write the following function taking in an integer vector (vector &prices) consisting of all prices, in chronological order, for an hypothetical instrument. Your function recommends the maximum profit an investor can make by placing AT MOST one buy and one sell order in the time slice represented by your input vector. Remember BUY LOW, SELL HIGH
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT