Εργαστήριο Οργάνωσης Η/Υ Δαδαλιάρης Αντώνιος dadaliaris@uth.gr
Συνδυαστικό Κυκλωμα: Το κύκλωμα του οποίου οι έξοδοι εξαρτώνται αποκλειστικά από τις τρέχουσες εισόδους του. Ακολουθιακό Κύκλωμα: Το κύκλωμα του οποίου οι έξοδοι εξαρτώνται όχι μόνο από τις τρέχουσες εισόδους του, αλλά και από την προηγούμενη ακολουθία εισόδων (μνήμη). Βασικά Στοιχεία Μνήμης: D Latch D Flip Flop (DFF) RAM
Ένα DFF δέχεται στην είσοδό του δεδομένα και ένα σήμα ρολογιού. Το DFF ενεργοποιείται όταν υπάρχει συγκεκριμένη μετάβαση στο σήμα ρολογιού. Η ενεργοποίηση σημαίνει ότι η τιμή των δεδομένων η οποία έχει διαβαστεί σε κάποια προηγούμενη χρονική στιγμή, βρίσκεται αποθηκευμένη και προωθείται στην έξοδο μετά την αλλαγή του ρολογιού. Negative / Positive Edge Triggered Asynchronous / Synchronous Reset
T hold : Το χρονικό διάστημα κατά το οποίο το d πρέπει να παραμείνει σταθερό μετά την θετική ακμή του ρολογιού. T setup : Το χρονικό διάστημα κατά το οποίο το d πρέπει να παραμείνει σταθερό πριν από την θετική ακμή του ρολογιού. T clock-to-q : Το χρονικό διάστημα που απαιτείται για την μετάβαση του d στην έξοδο q. metastability
Positive Edge Triggered DFF entity dff is clk, d: in std_logic; q: out std_logic end dff; architecture arch of dff is process(clk) if (clk event and clk= 1 ) then q <= d; end arch;
DFF with Asynchronous Reset entity dffr is clk, reset, d: in std_logic; q: out std_logic end dffr; architecture arch of dffr is process(clk,reset) if (reset= 1 ) then q <= 0 ; elsif rising_edge(clk) then q <= d; end arch;
DFF with Synchronous Reset entity dffr is clk, reset, d: in std_logic; q: out std_logic end dffr; architecture arch of dffr is process(clk) if (clk'event and clk= 1 ) then if (reset = '1') then q <= 0 ; else q <= d; end arch;
Register: multiple DFFs same clock same reset entity reg8 is clk, reset: in std_logic; d: in std_logic_vector(7 downto 0 q: out std_logic_vector(7 downto 0) end reg8; architecture arch of reg8 is process(clk, reset) if (reset= 1 ) then q <= (others=> 0 elsif (clk event and clk= 1 ) then q <= d; end arch;
Shift Registers: Serial In - Serial Out (SISO) Serial In - Parallel Out (SIPO) Parallel In - Parallel Out (PIPO) Parallel In - Serial Out (PISO)
Serial In - Serial Out (SISO) entity siso is clk : in std_logic; si : in std_logic; so : out std_logic end siso; architecture arch of siso is signal temp : std_logic_vector (7 downto 0 process (clk) if (clk'event and clk='1') then temp(7 downto 1) <= temp(6 downto 0 temp(0) <= si; so <= temp(7 end arch;
Serial In - Parallel Out (SIPO) entity sipo is clk,si: in std_logic; po : inout std_logic_vector(7 downto 0) end sipo; architecture arch of sipo is process(clk) if (clk='1' and clk'event)then po(7 downto 1) <= po(6 downto 0 po(0) <= si; end arch;
Parallel In - Parallel Out (PIPO) entity pipo is clk : in std_logic; pi : in std_logic_vector(7 downto 0 po : out std_logic_vector(7 downto 0) end pipo; architecture arch of pipo is process (clk) if (CLK'event and CLK='1') then po <= pi; end arch;
Parallel In - SerialOut (PISO) entity piso is clk,load : in std_logic; pi : in std_logic_vector(7 downto 0 so : out std_logic end piso; architecture arch of piso is signal t : std_logic; signal temp: std_logic_vector(7 downto 0 process (clk,pi,load) if (load='1') then temp(7 downto 0) <= pi(7 downto 0 elsif (CLK'event and CLK='1') then t <= temp(7 temp(7 downto 1) <= temp(6 downto 0 temp(0) <= '0'; so <= t; end arch;
Enable signals Ενεργοποίηση Clear signals Μηδενισμος εισόδου / εξόδου Reset signals Μηδενισμός εξόδου Set signals Ανάθεση τιμών
8-bit BCD counter: asynchronous reset clock enable entity counter is clock_enable, clock, reset: in std_logic; output: out std_logic_vector(7 downto 0) end counter; architecture behavioral of counter is signal temp: std_logic_vector(7 downto 0 process(clock, reset) if (reset = '1') then temp <= "00000000"; elsif (rising_edge(clock)) then if (clock_enable = '0') then if (temp = "10000001") then temp <= "00000000"; else temp <= temp + 1; output<=temp; end behavioral;
8-bit Binary counter: load enable load new number continue counting entity count8 is din: in std_logic_vector(7 downto 0 clk, load: in std_logic; dout: std_logic_vector(7 downto 0) end count8; architecture behavioral of count8 is process(clk) variable count: unsigned(7 downto 0):= "00000000"; if (clk'event and clk = '1') then if load = '1' then count := din; else count := count + 1; dout <= count; end behavioral;
6η Ανάθεση 1. Ποιά είναι η διαφορά μεταξύ ενός level sensitive element και ενός edge sensitive element; Αναφέρετε δύο παραδείγματα, εξηγείστε την λειτουργία τους και παραθέστε τους κατάλληλους πίνακες αληθείας. 2. Περιγράψτε την λειτουργία των παραπάνω shift register. Ποιές διαφορές παρατηρούνται ως προς τον χρονισμό τους; 3. Υλοποιείστε τους παραπάνω shift register εισάγοντας ένα σήμα ασύγχρονου μηδενισμού. 4. Υλοποιείστε ένα 8-bit SISO Shift Register με Clock Enable. 5. Υλοποιείστε ένα 16-bit SISO Shift Register με Asynchronous Clear. 6. Υλοποιείστε ένα 32-bit SISO Shift Register με Asynchronous Parallel Load. 7. Υλοποιείστε έναν modulo 10 counter χρησιμοποιώντας DFFs. 8. Τοποθετείστε κατάλληλους shift register στην έξοδο της ALU από την προηγούμενη ανάθεση. Προσομοιώστε την σχεδίαση και με τους 4 διαφορετικούς shift register και εξηγείστε ποιές διαφορές παρατηρούνται ως προς το χρονισμό των παραπάνω σχεδιάσεων. 9. Ποιά είναι τα βασικά πλεονεκτήματα και μειονεκτήματα των σύγχρονων σχεδιάσεων; 10. Ποιά είναι τα βασικά πλεονεκτήματα και μειονεκτήματα των ασύγχρονων σχεδιάσεων; 11. Προσομοιώστε τον 8-bit counter και αναφέρετε ποιό μπορεί να είναι ένα πιθανό πρόβλημα κατά την λειτουργία του.