-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path12_divblock.vhd
74 lines (58 loc) · 1.93 KB
/
12_divblock.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--------------------------
-- 8-bit block DIV gate --
--------------------------
-- Utilise 1 SUB8 + 1 MUX8 + 1 NOT + 1 AND tous en cascade
-- Donc 144 + 32 + 3 = 179 NANDS.
-- Q = AND(CTR, A >= B)
-- Si Q = 1, propage le resultat de la soustraction dans R, i.e. R = A - B.
-- Si Q = 0, R = A.
-- Temps latence max = ( 1 SUB8 + 1 MUX8 + 3 NANDS en cascade) = 34 + 3 + 3 = 40 NANDS de latence max
library ieee;
use ieee.std_logic_1164.all;
use work.all;
entity DIV8BLOCK_GATE is
port( A: in std_logic_vector (7 downto 0);
B: in std_logic_vector (7 downto 0);
CTR: in std_logic;
Q: inout std_logic;
R: out std_logic_vector (7 downto 0));
end DIV8BLOCK_GATE;
architecture arch of DIV8BLOCK_GATE is
component AND_GATE
port( A: in std_logic;
B: in std_logic;
Q: out std_logic);
end component;
component NOT_GATE
port( A: in std_logic;
Q: out std_logic);
end component;
component SUB8_GATE
port( A: in std_logic_vector (7 downto 0);
B: in std_logic_vector (7 downto 0);
C_IN: in std_logic; -- retenue précédente
Q: out std_logic_vector (7 downto 0);
C_OUT: out std_logic); -- C_OUT = nouvelle retenue
end component;
component MUX8_GATE
port( A: in std_logic_vector (7 downto 0);
B: in std_logic_vector (7 downto 0);
C: in std_logic;
Q: out std_logic_vector (7 downto 0));
end component;
signal R_temp: std_logic_vector (7 downto 0);
signal carry: std_logic;
signal not_carry: std_logic;
begin
-- entity DIV8BLOCK_GATE is
-- port(A: in std_logic_vector (7 downto 0);
-- B: in std_logic_vector (7 downto 0);
-- CTR: in std_logic;
-- Q: inout std_logic;
-- R: out std_logic_vector (7 downto 0));
-- end DIV8BLOCK_GATE;
Sub1: SUB8_GATE port map (A, B, '0', R_temp, carry);
Not1: NOT_GATE port map (carry, not_carry);
And1: AND_GATE port map (CTR, not_carry, Q);
Mux1: MUX8_GATE port map (A, R_temp, Q, R);
end arch;