Lösung des Praktikums Systementwurf
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reg32.vhd 954B

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. package reg32 is
  4. subtype Word is std_logic_vector( 31 downto 0 );
  5. type RegArray is array ( natural range <> ) of Word;
  6. type AccessType is (
  7. NONE,
  8. READ_ONLY,
  9. WRITE_ONLY,
  10. READ_WRITE
  11. );
  12. type AccessArray is array ( natural range <> ) of AccessType;
  13. function allows_read( access_type : AccessType )
  14. return boolean;
  15. function allows_write( access_type : AccessType )
  16. return boolean;
  17. end package reg32;
  18. package body reg32 is
  19. function allows_read( access_type : AccessType )
  20. return boolean is
  21. begin
  22. return access_type = READ_ONLY or access_type = READ_WRITE;
  23. end function allows_read;
  24. function allows_write( access_type : AccessType )
  25. return boolean is
  26. begin
  27. return access_type = WRITE_ONLY or access_type = READ_WRITE;
  28. end function allows_write;
  29. end package body reg32;