Professional Documents
Culture Documents
Digital 1 W7 Noted
Digital 1 W7 Noted
Digital design 1
Design een 16 bits adder/subtractor circuit
Sel=0 Add
Sel=1 Sub
14
Oefening VHDL: library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
A B entity ADD_SUB is
port (
A, B: in std_logic_vector(15
Symbol: sel
downto 0);
begin
ADD: process ( )
begin
Add Sub -- add process
end process;
S1 Co S2 Bo SUB: process ( )
begin
-- sub process
Sel Select end process;
SELECT: process( )
begin
-- select process
end process;
Result CoBo end behavior;
18
N-bits Digital Comparator
A Eq
B Gt
St
Het is combinatorisch
17
Schrijf een code die de input A en B gaat vergelijken
A 3
2- VHDL
3 Eq
B library ieee;
use ieee.std_logic_1164.all;
entity comp is
1- Truth Table, minimization etc.. port (
A, B: in std_logic_vector(2 downto 0);
A2A1A0 B2B1B0 Eq Eq: out std_logic
);
000 000 1 end comp;
000 001 0
000 010 0 architecture behavior of comp is
Begin
000 011 0
000 100 0 process( )
000 101 0 begin
……………… …
…………….. … end process;
100 10 1 End behavior;
0 …
18
…………….. …
……………..
A7 Epar
Parity generator A0
library ieee;
use ieee.std_logic_1164.all;
entity comp is
port (
A7, A6, A5, A4, A3, A2, A1, A0: in
std_logic; par: out std_logic
);
end comp;
process()
begin
end process;
end behavior;
23
ALU design
Digital design 1
8
Computer architecture
CPU
Memory Central
Input
Processing Memory
Input
Unit (CPU) Output
Output
9
Central Processing Unit
Control Arithmetic
Unit (CU) Logic
Unit
(ALU)
1
0
Arithmetic Logic Unit (ALU)
• Een arithmetic logic unit (ALU) is een digitale circuit die gebruikt wordt om
aritmetische en logische operaties toe te passen.
• Het representeert een fundamenteel blok voor een central processing unit
(CPU) van een computer.
• Moderne CPUs hebben een complexe en krachtige ALUs. Daarbij hebben
moderne CPUs ook een control unit (CU).
• Je kan eender welke functie toevoegen aan de ALU.
11
ALU design oefening
12
ALU design oefening
1- Select function
ALU design oefening
1- Subfunctions block diagram
ALU with the functions OR, AND, SUB and ADD
3- Truth table of VHDL library ieee;
use ieee.std_logic_1164.all;
entity ALU is
port ( A,B: in std_logic_vector(3 downto 0);
Sel : in std_logic_vector (1 downto 0);
result: out std_logic_vector (3 downto 0)
);
end ALU ;
end process;
end behavior;
9
Sequential design
Digital design16
1
Computer architecture
CPU
Memory Central
Input
Processing Memory
Input
Unit (CPU) Output
Output
1
7
System
Sequential Systems
Feedback
C ABC Q
& 010 0
A
& Q
011 0
111 1
B 110 0
AB Q
A & 01 0
B
& Q
11 0
10 1
11 1
10
Sequential vs. combinational
Inputs Outputs
Inputs
# Outputs
Embedded Connectivity 20
Exercise 1: Parity generator
•In serial data transmission, a common format is 8 data bits, a parity bit (odd or even), a start bit and
one or two stop bits. Hence a parity generator is needed at the sender side and a parity checker is
needed at the receiver side (Example: UART). Parity bits are used as the simplest form of error
detecting code.
•Design a circuit that detects whether there are an odd number of 1s in an input bit stream. Assume
that the rate of inputs is 1 every clock cycle.
21
Exercise 1
1
0
S1
IsOdd=0
S2
IsOdd=1
rst
0
1
bit
# IsOdd
22
Exercise 1
Digital design 1 23
Exercise 1
Exercise 1
Digital design 1 25
Exercise 1 ARCHITECTURE parity_check_architecture OF parity_check IS
--signals goes here
type t_State is (odd, even);
signal ps, ns : t_state;
BEGIN
END parity_check_architecture;
26