relu.vhd 591 B

123456789101112131415161718192021222324252627282930
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.std_logic_signed.all;
  4. use IEEE.std_logic_arith.all;
  5. use IEEE.math_real.all;
  6. use work.myPackage.ALL;
  7. entity relu is
  8. Port ( inp : in dataType;
  9. outp : out dataType;
  10. clk: in STD_LOGIC );
  11. end relu;
  12. architecture Behavioral of relu is
  13. begin
  14. calc : process(clk)
  15. begin
  16. if(rising_edge(clk)) then
  17. if(signed(inp) > 0) then
  18. outp <= inp;
  19. else
  20. outp <= (others => '0');
  21. end if;
  22. end if;
  23. end process;
  24. end Behavioral;