--========================================================== -- Design units : DIVbehave -- (entity, architecture and configuration) -- -- File name : DIVbehave.vhd -- -- Purpose : Behavioral description of a divider -- array -- -- Limitations : K > M > 0 -- -- Library : WORK -- -- Dependencies : None -- -- Author : Hans-Peter Eich, REFT -- -- Simulator : Synopsys V3.1a on SUN SPARCstation 10 -- ----------------------------------------------------------- -- Revision list -- Version Author Date Changes -- -- V1.0 hpe 20.01.95 ESA standard -- V1.0 hpe 03.04.95 comments --========================================================= ENTITY DIVbehave IS -- N = Q*D + R GENERIC(M: Positive := 3; -- bit length of divisor K: Positive := 6); -- bit length of dividend PORT(N_in: IN Integer RANGE (2**K)-1 DOWNTO 0; -- dividend in D_in: IN Integer RANGE (2**M)-1 DOWNTO 0; -- divisor in Q_out: OUT Integer RANGE (2**(K-M))-1 DOWNTO 0; -- quotient out R_out: OUT Integer RANGE (2**M)-1 DOWNTO 0); -- remainder out END DIVbehave; --============================ARCHITECTURE================== ARCHITECTURE Behavior OF DIVbehave IS BEGIN main : PROCESS (N_in,D_in) VARIABLE temp_N : Integer RANGE (2**K)-1 DOWNTO 0; VARIABLE temp_D : Integer RANGE (2**(K-1))-1 DOWNTO 0; VARIABLE count : Integer RANGE (2**(K-M))-1 DOWNTO 0; BEGIN count := 0; temp_N := N_in; temp_D := D_in * 2**(K-M-1); loop_1 : FOR i IN K-M-1 DOWNTO 0 LOOP IF temp_N >= temp_D THEN count := count + 1; temp_N := temp_N - temp_D; END IF; temp_D := temp_D / 2; IF i > 0 THEN count := 2 * count; END IF; END LOOP loop_1; Q_out <= count MOD 2**(K-M); R_out <= temp_N MOD 2**M; END PROCESS; END Behavior; --============================CONFIGURATION================= CONFIGURATION DIVbehave_Config OF DIVbehave IS FOR Behavior END FOR; END DIVbehave_Config;