Tom Kelliher, CS 220
Nov. 7, 2003
Return homework; collect homework
Homework due Wednesday; exam Friday.
Read 5-3.
VHDL for sequential circuits.
Serial registers.
Examples: register file, MDR, MAR.
Example: program counter.
Use a mux approach:
Gating the clock will save the muxes, but clock gating is usually a bad idea --- clock skew problems.
clockToFF = load and clock
clockToFF = !load or clock
-- VHDL for 32 bit parallel load register with asynchronous low -- reset. library ieee; use ieee.std_logic_1164.all; entity parallel_register is port ( clock, load, reset_n : in std_logic; d : in std_logic_vector (31 downto 0); q : out std_logic_vector (31 downto 0)); end parallel_register; architecture dataflow of parallel_register is signal state : std_logic_vector (31 downto 0); begin -- dataflow q <= state; -- Output process. state_reg : process (clock, reset_n) begin -- process state if (reset_n = '0') then -- asynchronous reset (active low) state <= X"00000000"; elsif (clock'event and clock = '1') then -- rising clock edge if (load = '1') then state <= d; else state <= state; end if; end if; end process state_reg; end dataflow;