summaryrefslogtreecommitdiff
path: root/pb_APP_log_comb.srcs/sources_1
diff options
context:
space:
mode:
authorLYAM <cous5830@gmail.com>2025-05-05 10:43:59 -0400
committerLYAM <cous5830@gmail.com>2025-05-05 10:43:59 -0400
commit95c62ef1b4f8dcb374cb43bbeb815f95532db67c (patch)
treef9289919f80b48bbca6b3af0496df8eb975ff724 /pb_APP_log_comb.srcs/sources_1
parent21c0053ad9597486a9a677fecb2e92dde80d38c2 (diff)
Thermo without error checks
Diffstat (limited to 'pb_APP_log_comb.srcs/sources_1')
-rw-r--r--pb_APP_log_comb.srcs/sources_1/new/Thermo2Bin.vhd92
1 files changed, 92 insertions, 0 deletions
diff --git a/pb_APP_log_comb.srcs/sources_1/new/Thermo2Bin.vhd b/pb_APP_log_comb.srcs/sources_1/new/Thermo2Bin.vhd
new file mode 100644
index 0000000..73585e3
--- /dev/null
+++ b/pb_APP_log_comb.srcs/sources_1/new/Thermo2Bin.vhd
@@ -0,0 +1,92 @@
+----------------------------------------------------------------------------------
+-- Company:
+-- Engineer:
+--
+-- Create Date: 05/05/2025 09:48:51 AM
+-- Design Name:
+-- Module Name: Thermo2Bin - Behavioral
+-- Project Name:
+-- Target Devices:
+-- Tool Versions:
+-- Description:
+--
+-- Dependencies:
+--
+-- Revision:
+-- Revision 0.01 - File Created
+-- Additional Comments:
+--
+----------------------------------------------------------------------------------
+
+
+library IEEE;
+use IEEE.STD_LOGIC_1164.ALL;
+
+-- Uncomment the following library declaration if using
+-- arithmetic functions with Signed or Unsigned values
+--use IEEE.NUMERIC_STD.ALL;
+
+-- Uncomment the following library declaration if instantiating
+-- any Xilinx leaf cells in this code.
+--library UNISIM;
+--use UNISIM.VComponents.all;
+
+entity Thermo2Bin is
+ Port ( thermo_bus : in STD_LOGIC_VECTOR (11 downto 0);
+ binary_out : out STD_LOGIC_VECTOR (3 downto 0);
+ error : out STD_LOGIC);
+end Thermo2Bin;
+
+architecture Behavioral of Thermo2Bin is
+ signal first_segment_of_four : STD_LOGIC_VECTOR(3 downto 0);
+ signal second_segment_of_four : STD_LOGIC_VECTOR(3 downto 0);
+ signal third_segment_of_four : STD_LOGIC_VECTOR(3 downto 0);
+
+ component Add4Bits is
+ Port ( A : in STD_LOGIC_VECTOR (3 downto 0);
+ B : in STD_LOGIC_VECTOR (3 downto 0);
+ C : in STD_LOGIC;
+ R : out STD_LOGIC_VECTOR (3 downto 0);
+ Rc : out STD_LOGIC);
+ end component;
+
+ 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
+ -- 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)
+
+ -- 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)
+
+ -- 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)
+
+ -- Addition des 3 compte ensemble
+ first_plus_second_adder : Add4Bits port map (
+ A => first_segment_of_four,
+ B => second_segment_of_four,
+ R => first_plus_second,
+ Rc => carry_out_first_plus_second,
+ C => '0'
+ );
+
+ plus_third_adder : Add4Bits port map (
+ A => first_plus_second,
+ B => third_segment_of_four,
+ R => binary_out,
+ Rc => last_carry_out,
+ C => carry_out_first_plus_second
+ );
+
+end Behavioral;