{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Hw6s - source code listing for this homework(no simulation...

This preview shows page 1. Sign up to view the full content.

- 1 - CSE 260 Homework 6 Due September 24, 2008 1. (10 points) Write a VHDL module that has a single 4 bit input x and returns a 4 bit value equal to the x /2, in the format of a fixed-point number jkl.m . Implement your circuit using a table of constants. You will need the following function declaration that converts a signal of type std_logic_vector to integer , since the index used in an array must be of type integer . function int(d: std_logic_vector) return integer is -- Convert logic vector to integer. Handy for array indexing. begin return conv_integer(unsigned(d)); end function int; While you may wish to write this and simulate it in the Xilinx tools, you only need to provide your
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: source code listing for this homework (no simulation output is required). entity div2 is port ( x: in std_logic_vector(3 downto 0); result: out std_logic_vector(3 downto 0)); end div2; architecture arch of div2 is type table is array(0 to 15) of std_logic_vector(3 downto 0); signal div2Tbl: table := ( "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111", ); function int(d: std_logic_vector) return integer is -- Convert logic vector to integer. Handy for array indexing. begin return conv_integer(unsigned(d)); end function int; begin result <= div2Tbl (int(x)); end arch;...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern