Skip to content

Commit 7ea10a7

Browse files
unknownunknown
unknown
authored and
unknown
committed
final report done
1 parent 259145e commit 7ea10a7

File tree

179 files changed

+24168
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+24168
-0
lines changed
713 KB
Binary file not shown.
639 KB
Binary file not shown.

Diff for: waveform_output/Lab2/LabReport/Lab_RTL_Diagram.PNG

40.5 KB
Loading

Diff for: waveform_output/Lab2/LabReport/adding.png

35.7 KB
Loading

Diff for: waveform_output/Lab2/LabReport/compilationReport.PNG

86.4 KB
Loading

Diff for: waveform_output/Lab2/LabReport/logicGates.PNG

32.5 KB
Loading

Diff for: waveform_output/Lab2/Logic_Processor.vhd

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
library ieee;
2+
use ieee.std_logic_1164.all;
3+
use ieee.numeric_std.all;
4+
5+
6+
entity Logic_Processor is port (
7+
8+
hexA : in std_logic_vector(3 downto 0); --input 1
9+
10+
hexB : in std_logic_vector(3 downto 0); --input 2
11+
12+
pressButton : in std_logic_vector ( 2 downto 0); --buttons for operator selection
13+
14+
output : out std_logic_vector(7 downto 0) --output of the operation
15+
16+
17+
);
18+
end Logic_Processor;
19+
20+
architecture Behavioral of Logic_Processor is
21+
22+
signal operator : std_logic_vector(2 downto 0);
23+
24+
25+
begin
26+
27+
operator <= not pressButton(2) & not pressButton(1) & not pressButton(0);
28+
29+
30+
with operator select
31+
output<= "0000" & (hexA and hexB) when "001", --define the operator depending on button inputs
32+
"0000" & (hexA or hexB) when "010",
33+
"0000" & (hexA xor hexB) when "100",
34+
"00000000" when others;
35+
36+
37+
38+
end architecture Behavioral;
39+
----------------------------------------------------------------------

Diff for: waveform_output/Lab2/Logic_Processor.vhd.bak

Whitespace-only changes.

Diff for: waveform_output/Lab2/LogicalStep_Lab2.qpf

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -------------------------------------------------------------------------- #
2+
#
3+
# Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
4+
# Your use of Altera Corporation's design tools, logic functions
5+
# and other software and tools, and its AMPP partner logic
6+
# functions, and any output files from any of the foregoing
7+
# (including device programming or simulation files), and any
8+
# associated documentation or information are expressly subject
9+
# to the terms and conditions of the Altera Program License
10+
# Subscription Agreement, the Altera Quartus Prime License Agreement,
11+
# the Altera MegaCore Function License Agreement, or other
12+
# applicable license agreement, including, without limitation,
13+
# that your use is for the sole purpose of programming logic
14+
# devices manufactured by Altera and sold by Altera or its
15+
# authorized distributors. Please refer to the applicable
16+
# agreement for further details.
17+
#
18+
# -------------------------------------------------------------------------- #
19+
#
20+
# Quartus Prime
21+
# Version 15.1.0 Build 185 10/21/2015 SJ Standard Edition
22+
# Date created = 09:06:29 January 23, 2018
23+
#
24+
# -------------------------------------------------------------------------- #
25+
26+
QUARTUS_VERSION = "15.1"
27+
DATE = "09:06:29 January 23, 2018"
28+
29+
# Revisions
30+
31+
PROJECT_REVISION = "LogicalStep_Lab2_top"

Diff for: waveform_output/Lab2/LogicalStep_Lab2.tcl

+296
Large diffs are not rendered by default.

Diff for: waveform_output/Lab2/LogicalStep_Lab2_top.qsf

+307
Large diffs are not rendered by default.

Diff for: waveform_output/Lab2/LogicalStep_Lab2_top.qws

1.2 KB
Binary file not shown.

Diff for: waveform_output/Lab2/LogicalStep_Lab2_top.vhd

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
library ieee;
2+
use ieee.std_logic_1164.all;
3+
use ieee.numeric_std.all;
4+
5+
6+
entity LogicalStep_Lab2_top is port (
7+
clkin_50 : in std_logic;
8+
pb : in std_logic_vector(3 downto 0);
9+
sw : in std_logic_vector(7 downto 0); -- The switch inputs
10+
leds : out std_logic_vector(7 downto 0); -- for displaying the switch content
11+
seg7_data : out std_logic_vector(6 downto 0); -- 7-bit outputs to a 7-segment
12+
seg7_char1 : out std_logic; -- seg7 digit1 selector
13+
seg7_char2 : out std_logic -- seg7 digit2 selector
14+
15+
);
16+
end LogicalStep_Lab2_top;
17+
18+
architecture SimpleCircuit of LogicalStep_Lab2_top is
19+
--
20+
-- Components Used ---
21+
-------------------------------------------------------------------
22+
component SevenSegment port ( -- converts a 4-bit number to 7 bit-number to be use for the 7-segment display
23+
hex : in std_logic_vector(3 downto 0); -- The 4 bit data to be displayed
24+
sevenseg : out std_logic_vector(6 downto 0) -- 7-bit outputs to a 7-segment
25+
);
26+
end component;
27+
28+
component concatenate port ( -- concatenate 2 signals(4-bit numbers)
29+
hexA : in std_logic_vector(3 downto 0);
30+
hexB : in std_logic_vector(3 downto 0);
31+
output : out std_logic_vector(7 downto 0)
32+
);
33+
end component;
34+
35+
component mux port ( --selector to let pass hexin1 or hexin2
36+
hex_in1, hex_in2 : in std_logic_vector(7 downto 0);
37+
mux_select : in std_logic;
38+
hex_out : out std_logic_vector(7 downto 0)
39+
);
40+
end component;
41+
42+
component segment7_mux port (
43+
clk : in std_logic :='0';
44+
DIN2 : in std_logic_vector(6 downto 0);
45+
DIN1 : in std_logic_vector(6 downto 0);
46+
DOUT : out std_logic_vector(6 downto 0);
47+
DIG2 : out std_logic;
48+
DIG1 : out std_logic
49+
);
50+
end component;
51+
52+
component add port( --function for adding two 4-bit numbers and outputs a 8-bit number
53+
hexA : in std_logic_vector(3 downto 0);
54+
hexB : in std_logic_vector(3 downto 0);
55+
output : out std_logic_vector(7 downto 0)
56+
);
57+
end component;
58+
59+
component Logic_Processor is port ( --function seletor between add, xor, or
60+
61+
hexA : in std_logic_vector(3 downto 0);
62+
hexB : in std_logic_vector(3 downto 0);
63+
pressButton : in std_logic_vector ( 2 downto 0);
64+
output : out std_logic_vector(7 downto 0)
65+
66+
);
67+
end component;
68+
69+
70+
-- Create any signals, or temporary variables to be used
71+
--
72+
-- std_logic_vector is a signal which can be used for logic operations such as OR, AND, NOT, XOR
73+
--
74+
signal seg7_A : std_logic_vector(6 downto 0); -- final output for hexA to seg7
75+
signal hex_A : std_logic_vector(3 downto 0); -- input number 1
76+
77+
signal seg7_B : std_logic_vector(6 downto 0); --final output for hexB to seg7
78+
signal hex_B : std_logic_vector(3 downto 0); --input number 2
79+
80+
signal concatenationResult : std_logic_vector(7 downto 0); --result after concatenation of both inputs
81+
signal sumResult: std_logic_vector(7 downto 0); --result after adition of the two inputs
82+
83+
signal arithmetic_result : std_logic_vector(7 downto 0); -- = sum if pb[3] is pressed ELSE = concatenation result
84+
85+
signal logicOutput: std_logic_vector (7 downto 0); ----result obtain after the logical processor
86+
87+
-- Here the circuit begins
88+
89+
begin
90+
91+
hex_A <= sw(3 downto 0); --assign input 1 to switches 3 to 0
92+
hex_B <= sw(7 downto 4); --assign input 2 to switches 7 to 4
93+
94+
95+
INST1: SevenSegment port map(arithmetic_Result(7 downto 4), seg7_A); --ports input 2 to 7-segment display on the fpga
96+
INST2: SevenSegment port map(arithmetic_Result(3 downto 0), seg7_B); --ports input 1 to 7-segment display on the fpga
97+
INST3: segment7_mux port map(clkin_50, seg7_B, seg7_A, seg7_data, seg7_char2, seg7_char1); --
98+
INST4: concatenate port map( hex_B, hex_A, concatenationResult); -- ports concatenated inputs
99+
INST5: add port map( hex_B, hex_A, sumResult); --ports added result
100+
INST6: mux port map(concatenationResult, sumResult, not pb(3), arithmetic_Result); --ports concatenationResult
101+
102+
INST7: Logic_Processor port map(hex_A, hex_B, pb (2 downto 0), logicOutput); -- reverted at the lower level
103+
INST8: mux port map(sumResult, logicOutput, pb(3), leds); --ports mux result depending on selected buttons
104+
105+
end SimpleCircuit;
106+

Diff for: waveform_output/Lab2/LogicalStep_Lab2_top.vhd.bak

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
library ieee;
2+
use ieee.std_logic_1164.all;
3+
use ieee.numeric_std.all;
4+
5+
6+
entity LogicalStep_Lab2_top is port (
7+
clkin_50 : in std_logic;
8+
pb : in std_logic_vector(3 downto 0);
9+
sw : in std_logic_vector(7 downto 0); -- The switch inputs
10+
leds : out std_logic_vector(7 downto 0); -- for displaying the switch content
11+
seg7_data : out std_logic_vector(6 downto 0); -- 7-bit outputs to a 7-segment
12+
seg7_char1 : out std_logic; -- seg7 digit1 selector
13+
seg7_char2 : out std_logic -- seg7 digit2 selector
14+
15+
);
16+
end LogicalStep_Lab2_top;
17+
18+
architecture SimpleCircuit of LogicalStep_Lab2_top is
19+
--
20+
-- Components Used ---
21+
-------------------------------------------------------------------
22+
component SevenSegment port (
23+
hex : in std_logic_vector(3 downto 0); -- The 4 bit data to be displayed
24+
sevenseg : out std_logic_vector(6 downto 0) -- 7-bit outputs to a 7-segment
25+
);
26+
end component;
27+
28+
29+
-- Create any signals, or temporary variables to be used
30+
--
31+
-- std_logic_vector is a signal which can be used for logic operations such as OR, AND, NOT, XOR
32+
--
33+
signal seg7_A : std_logic_vector(6 downto 0);
34+
signal hex_A : std_logic_vector(3 downto 0);
35+
36+
37+
-- Here the circuit begins
38+
39+
begin
40+
41+
42+
43+
44+
end SimpleCircuit;
45+

Diff for: waveform_output/Lab2/SevenSegment.vhd

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
library ieee;
2+
use ieee.std_logic_1164.all;
3+
use ieee.numeric_std.all;
4+
5+
-------------------------------------------------------------------------
6+
-- 7-segment display driver. It displays a 4-bit number on a 7-segment
7+
-- This is created as an entity so that it can be reused many times easily
8+
--
9+
10+
entity SevenSegment is port (
11+
12+
hex : in std_logic_vector(3 downto 0); -- The 4 bit data to be displayed
13+
14+
sevenseg : out std_logic_vector(6 downto 0) -- 7-bit outputs to a 7-segment
15+
);
16+
end SevenSegment;
17+
18+
architecture Behavioral of SevenSegment is
19+
20+
--
21+
-- The following statements convert a 4-bit input, called dataIn to a pattern of 7 bits
22+
-- The segment turns on when it is '1' otherwise '0'
23+
--
24+
begin
25+
with hex select --GFEDCBA 3210 -- data in
26+
sevenseg <= "0111111" when "0000", -- [0]
27+
"0000110" when "0001", -- [1]
28+
"1011011" when "0010", -- [2] +---- a -----+
29+
"1001111" when "0011", -- [3] | |
30+
"1100110" when "0100", -- [4] | |
31+
"1101101" when "0101", -- [5] f b
32+
"1111101" when "0110", -- [6] | |
33+
"0000111" when "0111", -- [7] | |
34+
"1111111" when "1000", -- [8] +---- g -----+
35+
"1101111" when "1001", -- [9] | |
36+
"1110111" when "1010", -- [A] | |
37+
"1111100" when "1011", -- [b] e c
38+
"1011000" when "1100", -- [c] | |
39+
"1011110" when "1101", -- [d] | |
40+
"1111001" when "1110", -- [E] +---- d -----+
41+
"1110001" when "1111", -- [F]
42+
"0000000" when others; -- [ ]
43+
end architecture Behavioral;
44+
----------------------------------------------------------------------

Diff for: waveform_output/Lab2/SevenSegment.vhd.bak

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
library ieee;
2+
use ieee.std_logic_1164.all;
3+
use ieee.numeric_std.all;
4+
5+
-------------------------------------------------------------------------
6+
-- 7-segment display driver. It displays a 4-bit number on a 7-segment
7+
-- This is created as an entity so that it can be reused many times easily
8+
--
9+
10+
entity SevenSegment is port (
11+
12+
hex : in std_logic_vector(3 downto 0); -- The 4 bit data to be displayed
13+
14+
sevenseg : out std_logic_vector(6 downto 0) -- 7-bit outputs to a 7-segment
15+
);
16+
end SevenSegment;
17+
18+
architecture Behavioral of SevenSegment is
19+
20+
--
21+
-- The following statements convert a 4-bit input, called dataIn to a pattern of 7 bits
22+
-- The segment turns on when it is '1' otherwise '0'
23+
--
24+
begin
25+
with hex select --GFEDCBA 3210 -- data in
26+
sevenseg <= "0111111" when "0000", -- [0]
27+
"0000110" when "0001", -- [1]
28+
"1011011" when "0010", -- [2] +---- a -----+
29+
"1001111" when "0011", -- [3] | |
30+
"1100110" when "0100", -- [4] | |
31+
"1101101" when "0101", -- [5] f b
32+
"1111101" when "0110", -- [6] | |
33+
"0000001" when "0111", -- [7] | |
34+
"1000000" when "1000", -- [8] +---- g -----+
35+
"1101111" when "1001", -- [9] | |
36+
"1110111" when "1010", -- [A] | |
37+
"1111100" when "1011", -- [b] e c
38+
"1011000" when "1100", -- [c] | |
39+
"1011110" when "1101", -- [d] | |
40+
"1111001" when "1110", -- [E] +---- d -----+
41+
"1000111" when "1111", -- [F]
42+
"0000000" when others; -- [ ]
43+
end architecture Behavioral;
44+
----------------------------------------------------------------------

Diff for: waveform_output/Lab2/add.vhd

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
library ieee;
2+
use ieee.std_logic_1164.all;
3+
use ieee.numeric_std.all;
4+
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5+
6+
7+
entity add is port (
8+
9+
hexA : in std_logic_vector(3 downto 0); --input 1
10+
11+
hexB : in std_logic_vector(3 downto 0); --input 2
12+
13+
output : out std_logic_vector(7 downto 0) --output for added result
14+
15+
16+
);
17+
end add;
18+
19+
architecture Behavioral of add is
20+
21+
22+
--
23+
begin
24+
25+
--trying to add hexA to hexB
26+
27+
output(7 downto 0) <=std_logic_vector(unsigned("0000" & hexA) + unsigned("0000" & hexB)); --function to add both inputs(concatenated)
28+
29+
30+
31+
32+
end architecture Behavioral;
33+
----------------------------------------------------------------------

Diff for: waveform_output/Lab2/add.vhd.bak

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
library ieee;
2+
use ieee.std_logic_1164.all;
3+
use ieee.numeric_std.all;
4+
5+
6+
entity add is port (
7+
8+
hexA : in std_logic_vector(3 downto 0);
9+
10+
hexB : in std_logic_vector(3 downto 0);
11+
12+
output : out std_logic_vector(7 downto 0)
13+
14+
15+
);
16+
end add;
17+
18+
architecture Behavioral of add is
19+
20+
--
21+
begin
22+
23+
--trying to add hexA to hexB
24+
25+
output = hexA + hexB;
26+
27+
28+
29+
end architecture Behavioral;
30+
----------------------------------------------------------------------

0 commit comments

Comments
 (0)