------------------------------------------------------------------------------- -- Titre : division sans restauration -- Projet : ------------------------------------------------------------------------------- -- Fichier : diviseur_a2.vhd -- Auteur : NOUEL Patrice -- Compagnie : -- Mise a jour : 2001/10/03 -- Platform : ------------------------------------------------------------------------------- -- Description : Architecture des ordinateurs -- Hennessy et Patterson -- page 843 ------------------------------------------------------------------------------- -- Modification history : -- 2001/10/03 : creation ------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; ARCHITECTURE sans_restauration OF diviseur IS BEGIN -- srt un_seul : PROCESS VARIABLE registre : unsigned(2*Nbr_bits DOWNTO 0); ALIAS p : unsigned(Nbr_bits DOWNTO 0) IS registre(2*Nbr_bits DOWNTO Nbr_bits); ALIAS a : unsigned(Nbr_bits-1 DOWNTO 0) IS registre(Nbr_bits-1 DOWNTO 0); VARIABLE b : unsigned(Nbr_bits DOWNTO 0); BEGIN WAIT ON init,h ; IF init = '1' THEN p(Nbr_bits-1 DOWNTO 0) := (OTHERS => '0'); p(Nbr_bits) := '1' ; a := dividende; b := '0' & diviseur; ELSE -- iterations FOR i IN 0 TO Nbr_bits-1 LOOP WAIT UNTIL rising_edge(h); registre := registre(2*Nbr_bits-1 DOWNTO 0) & (NOT registre(2*Nbr_bits)); IF p(Nbr_bits) = '1' THEN p := p + b; ELSE p := p - b; END IF; END LOOP; -- i -- sorties quotient <= a ; reste <= p(Nbr_bits-1 DOWNTO 0) ; END IF; END PROCESS un_seul; END sans_restauration;