aboutsummaryrefslogtreecommitdiff
path: root/sem6/dig/m2/ex5.vhdl
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-02-15 14:31:49 +0100
committerJulian T <julian@jtle.dk>2021-02-15 14:31:49 +0100
commit1e6f7a495318addcbb6bc5ae7465a2eb1d889acd (patch)
treea5a7a4940161a5814992e2775f4959ccb336f4d4 /sem6/dig/m2/ex5.vhdl
parent1ea5fe8262ffe148c78ebc393ffe4886232a221e (diff)
Add assignments for digital design
Diffstat (limited to 'sem6/dig/m2/ex5.vhdl')
-rw-r--r--sem6/dig/m2/ex5.vhdl18
1 files changed, 18 insertions, 0 deletions
diff --git a/sem6/dig/m2/ex5.vhdl b/sem6/dig/m2/ex5.vhdl
new file mode 100644
index 0000000..bfc27b9
--- /dev/null
+++ b/sem6/dig/m2/ex5.vhdl
@@ -0,0 +1,18 @@
+-- TEST_START{"inputs": ["a", "b", "cin"], "outputs": ["o", "cout"], "testin": ["000", "010", "100", "110", "011", "111"]}TEST_STOP
+LIBRARY IEEE;
+USE IEEE.STD_LOGIC_1164.all;
+
+ENTITY ex5 IS
+ PORT(
+ a: IN STD_LOGIC;
+ b: IN STD_LOGIC;
+ cin: IN STD_LOGIC;
+ o: OUT STD_LOGIC;
+ cout: OUT STD_LOGIC);
+END ex5;
+
+ARCHITECTURE impl OF ex5 IS
+BEGIN
+ o <= (a XOR b) XOR cin;
+ cout <= (a AND b) OR (cin AND (a OR b));
+END impl;