summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Readme.md2
-rw-r--r--pb_APP_log_comb.srcs/sim_1/new/Thermo2Bin_tb.vhd19
-rw-r--r--pb_APP_log_comb.srcs/sources_1/new/Thermo2Bin.vhd24
3 files changed, 42 insertions, 3 deletions
diff --git a/Readme.md b/Readme.md
index 0250d40..7eff830 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,6 +1,6 @@
# Tâches à faire
-- [ ] Thermo2Bin
+- [x] Thermo2Bin
- [x] Fct2_3
- [x] Décodeur 3_8
- [ ] Parité
diff --git a/pb_APP_log_comb.srcs/sim_1/new/Thermo2Bin_tb.vhd b/pb_APP_log_comb.srcs/sim_1/new/Thermo2Bin_tb.vhd
index 47bd13f..52a02fb 100644
--- a/pb_APP_log_comb.srcs/sim_1/new/Thermo2Bin_tb.vhd
+++ b/pb_APP_log_comb.srcs/sim_1/new/Thermo2Bin_tb.vhd
@@ -61,7 +61,7 @@ architecture Behavioral of Thermo2Bin_tb is
----------------------------------------------------------------------------
-- declaration d'un tableau pour soumettre un vecteur de test
----------------------------------------------------------------------------
- constant amount_of_tests: integer := 13;
+ constant amount_of_tests: integer := 26;
type table_valeurs_tests is array (integer range 0 to amount_of_tests) of std_logic_vector(16 downto 0);
constant mem_valeurs_tests : table_valeurs_tests := (
-- therm0 output err
@@ -81,6 +81,23 @@ architecture Behavioral of Thermo2Bin_tb is
"001111111111" & "1010" & "0", -- 10
"011111111111" & "1011" & "0", -- 11
"111111111111" & "1100" & "0", -- 12
+
+ "100011111111" & "1100" & "1", -- error
+ "010011111111" & "1100" & "1", -- error
+ "001011111111" & "1100" & "1", -- error
+ "101011111111" & "1100" & "1", -- error
+
+ "111101001111" & "1100" & "1", -- error
+ "111101011111" & "1100" & "1", -- error
+ "111110001111" & "1100" & "1", -- error
+ "111100001111" & "1100" & "1", -- error
+
+ "111111110000" & "1100" & "1", -- error
+ "111111111000" & "1100" & "1", -- error
+ "111111110100" & "1100" & "1", -- error
+ "111111110010" & "1100" & "1", -- error
+
+ "000000010000" & "1100" & "1", -- error
-- conserver la ligne ci-bas.
others => "000000000000" & "0000" & "0" -- 0 + 0
);
diff --git a/pb_APP_log_comb.srcs/sources_1/new/Thermo2Bin.vhd b/pb_APP_log_comb.srcs/sources_1/new/Thermo2Bin.vhd
index 73585e3..a6ae6bf 100644
--- a/pb_APP_log_comb.srcs/sources_1/new/Thermo2Bin.vhd
+++ b/pb_APP_log_comb.srcs/sources_1/new/Thermo2Bin.vhd
@@ -53,24 +53,32 @@ architecture Behavioral of Thermo2Bin is
signal first_plus_second : STD_LOGIC_VECTOR(3 downto 0);
signal carry_out_first_plus_second : STD_LOGIC;
signal last_carry_out : STD_LOGIC;
-begin
+
+begin
+ -- A, B, C, D
-- 11, 10, 9, 8
first_segment_of_four(3) <= '0'; -- E
first_segment_of_four(2) <= thermo_bus(11); -- F = A
first_segment_of_four(1) <= NOT thermo_bus(11) AND thermo_bus(9); -- G = A'C
first_segment_of_four(0) <= NOT thermo_bus(11) AND ((NOT thermo_bus(9) AND thermo_bus(8)) OR (thermo_bus(10) AND thermo_bus(9))); -- H = A'(C'D+BC)
+ -- C AND D ( B OR NOT A)
+ --error_first <= NOT (((thermo_bus(9) AND thermo_bus(8)) AND (thermo_bus(10) OR NOT thermo_bus(11))) OR ((NOT thermo_bus(11) AND NOT thermo_bus(10)) AND (thermo_bus(8) OR NOT thermo_bus(9))));
-- 7, 6, 5, 4
second_segment_of_four(3) <= '0'; -- E
second_segment_of_four(2) <= thermo_bus(7); -- F = A
second_segment_of_four(1) <= NOT thermo_bus(7) AND thermo_bus(5); -- G = A'C
second_segment_of_four(0) <= NOT thermo_bus(7) AND ((NOT thermo_bus(5) AND thermo_bus(4)) OR (thermo_bus(6) AND thermo_bus(5))); -- H = A'(C'D+BC)
+ --
+ --error_second <= NOT (((thermo_bus(5) AND thermo_bus(4)) AND (thermo_bus(6) OR NOT thermo_bus(7))) OR ((NOT thermo_bus(7) AND NOT thermo_bus(6)) AND (thermo_bus(4) OR NOT thermo_bus(5))));
-- 3, 2, 1, 0
third_segment_of_four(3) <= '0'; -- E
third_segment_of_four(2) <= thermo_bus(3); -- F = A
third_segment_of_four(1) <= NOT thermo_bus(3) AND thermo_bus(1); -- G = A'C
third_segment_of_four(0) <= NOT thermo_bus(3) AND ((NOT thermo_bus(1) AND thermo_bus(0)) OR (thermo_bus(2) AND thermo_bus(1))); -- H = A'(C'D+BC)
+ --
+ --error_third <= NOT (((thermo_bus(1) AND thermo_bus(0)) AND (thermo_bus(2) OR NOT thermo_bus(3))) OR ((NOT thermo_bus(3) AND NOT thermo_bus(2)) AND (thermo_bus(0) OR NOT thermo_bus(1))));
-- Addition des 3 compte ensemble
first_plus_second_adder : Add4Bits port map (
@@ -89,4 +97,18 @@ begin
C => carry_out_first_plus_second
);
+ error <= (
+ (thermo_bus(11) AND NOT thermo_bus(10)) OR
+ (thermo_bus(10) AND NOT thermo_bus(9)) OR
+ (thermo_bus(9) AND NOT thermo_bus(8)) OR
+ (thermo_bus(8) AND NOT thermo_bus(7)) OR
+ (thermo_bus(7) AND NOT thermo_bus(6)) OR
+ (thermo_bus(6) AND NOT thermo_bus(5)) OR
+ (thermo_bus(5) AND NOT thermo_bus(4)) OR
+ (thermo_bus(4) AND NOT thermo_bus(3)) OR
+ (thermo_bus(3) AND NOT thermo_bus(2)) OR
+ (thermo_bus(2) AND NOT thermo_bus(1)) OR
+ (thermo_bus(1) AND NOT thermo_bus(0))
+ );
+
end Behavioral;