fwd.vhd 863 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. use work.core_pkg.all;
  5. use work.op_pkg.all;
  6. entity fwd is
  7. port (
  8. -- from Mem
  9. reg_write_mem : in reg_write_type;
  10. -- from WB
  11. reg_write_wb : in reg_write_type;
  12. -- from/to EXEC
  13. reg : in reg_adr_type;
  14. val : out data_type;
  15. do_fwd : out std_logic
  16. );
  17. end entity;
  18. architecture rtl of fwd is
  19. begin
  20. -- sequential
  21. forward : process(all)
  22. begin
  23. do_fwd <= '0';
  24. val <= (others => '0');
  25. if reg_write_wb.write = '1' and reg_write_wb.reg = reg then
  26. if reg_write_wb.reg /= ZERO_REG then
  27. do_fwd <= '1';
  28. val <= reg_write_wb.data;
  29. end if;
  30. end if;
  31. if reg_write_mem.write = '1' and reg_write_mem.reg = reg then
  32. if reg_write_mem.reg /= ZERO_REG then
  33. do_fwd <= '1';
  34. val <= reg_write_mem.data;
  35. end if;
  36. end if;
  37. end process;
  38. end architecture;