-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdFF_2.vhd
61 lines (54 loc) · 2.17 KB
/
dFF_2.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
--------------------------------------------------------------------------------
-- Title : Type D Flip-Flop - 2nd realization
-- Project : VHDL Synthesis Overview
-------------------------------------------------------------------------------
-- File : dFF_2.vhd
-- Author : Rami Abielmona <rabielmo@site.uottawa.ca>
-- Created : 2003/05/17
-- Last modified : 2007/09/25
-------------------------------------------------------------------------------
-- Description : This file creates a flip-flop of type D as defined in the VHDL
-- Synthesis lecture. The architecture is done at the RTL
-- abstraction level and the implementation is done in structural
-- VHDL.
-------------------------------------------------------------------------------
-- Modification history :
-- 2003.05.17 R. Abielmona Creation
-- 2004.09.22 R. Abielmona Ported for CEG 3550
-- 2007.09.25 R. Abielmona Modified copyright notice
-------------------------------------------------------------------------------
-- This file is copyright material of Rami Abielmona, Ph.D., P.Eng., Chief Research
-- Scientist at Larus Technologies. Permission to make digital or hard copies of part
-- or all of this work for personal or classroom use is granted without fee
-- provided that copies are not made or distributed for profit or commercial
-- advantage and that copies bear this notice and the full citation of this work.
-- Prior permission is required to copy, republish, redistribute or post this work.
-- This notice is adapted from the ACM copyright notice.
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY dFF_2 IS
PORT(
i_d, i_clr : IN STD_LOGIC;
i_set : IN STD_LOGIC;
i_clock : IN STD_LOGIC;
o_q, o_qBar : OUT STD_LOGIC);
END dFF_2;
ARCHITECTURE rtl OF dFF_2 IS
SIGNAL int_q : STD_LOGIC;
BEGIN
oneBitRegister:
PROCESS(i_clock, i_clr, i_set)
BEGIN
IF (i_set = '0') THEN
int_q <= '1';
ELSIF (i_clr = '0') THEN
int_q <= '0';
ELSIF (rising_edge(i_clock)) THEN
int_q <= i_d after 1 ns;
END IF;
END PROCESS oneBitRegister;
-- Output Driver
o_q <= int_q;
o_qBar <= not(int_q);
END rtl;