Loesung des Praktikums Systementwurf - Bjarne Hoesch - Bernhard Schoeffel
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.

data_channel.vhd 3.2KB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. entity data_channel is
  5. generic (
  6. DEPTH : positive := 1024
  7. );
  8. port (
  9. clk : in std_logic;
  10. reset : in std_logic;
  11. ctrl_address : in std_logic_vector( 3 downto 0 );
  12. ctrl_read : in std_logic;
  13. ctrl_readdata : out std_logic_vector( 31 downto 0 );
  14. ctrl_write : in std_logic;
  15. ctrl_writedata : in std_logic_vector( 31 downto 0 );
  16. hw_sink_write : in std_logic;
  17. hw_sink_writedata : in std_logic_vector( 31 downto 0 );
  18. hw_source_read : in std_logic;
  19. hw_source_readdata : out std_logic_vector( 31 downto 0 )
  20. );
  21. end entity data_channel;
  22. architecture struct of data_channel is
  23. signal sink_config : std_logic;
  24. signal source_config : std_logic;
  25. signal clear : std_logic;
  26. signal empty : std_logic;
  27. signal full : std_logic;
  28. signal level : std_logic_vector( 9 downto 0 );
  29. signal ctrl_sink_write : std_logic;
  30. signal ctrl_sink_writedata : std_logic_vector( 31 downto 0 );
  31. signal ctrl_source_read : std_logic;
  32. signal ctrl_source_readdata : std_logic_vector( 31 downto 0 );
  33. signal sink_write : std_logic;
  34. signal sink_writedata : std_logic_vector( 31 downto 0 );
  35. signal source_read : std_logic;
  36. signal source_readdata : std_logic_vector( 31 downto 0 );
  37. begin
  38. u_control : entity work.data_channel_control
  39. port map (
  40. clk => clk,
  41. reset => reset,
  42. address => ctrl_address,
  43. read => ctrl_read,
  44. readdata => ctrl_readdata,
  45. write => ctrl_write,
  46. writedata => ctrl_writedata,
  47. sink_config => sink_config,
  48. source_config => source_config,
  49. clear => clear,
  50. empty => empty,
  51. full => full,
  52. level => level,
  53. sink_write => ctrl_sink_write,
  54. sink_writedata => ctrl_sink_writedata,
  55. source_read => ctrl_source_read,
  56. source_readdata => ctrl_source_readdata
  57. );
  58. u_data_sink_mux : entity work.data_sink_mux
  59. port map (
  60. sel => sink_config,
  61. sw_write => ctrl_sink_write,
  62. sw_writedata => ctrl_sink_writedata,
  63. hw_write => hw_sink_write,
  64. hw_writedata => hw_sink_writedata,
  65. write => sink_write,
  66. writedata => sink_writedata
  67. );
  68. u_fifo : entity work.fifo
  69. generic map (
  70. DEPTH => DEPTH
  71. )
  72. port map (
  73. aclr => reset,
  74. clock => clk,
  75. sclr => clear,
  76. data => sink_writedata,
  77. rdreq => source_read,
  78. wrreq => sink_write,
  79. empty => empty,
  80. full => full,
  81. q => source_readdata,
  82. usedw => level
  83. );
  84. u_data_source_mux : entity work.data_source_mux
  85. port map (
  86. sel => source_config,
  87. sw_read => ctrl_source_read,
  88. sw_readdata => ctrl_source_readdata,
  89. hw_read => hw_source_read,
  90. hw_readdata => hw_source_readdata,
  91. read => source_read,
  92. readdata => source_readdata
  93. );
  94. end architecture;