Studentenversion des ESY6/A Praktikums "signal_processing".
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.

signal_processing.vhd 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. --! Use ieee library for std_logic types.
  2. library ieee;
  3. use ieee.std_logic_1164.all;
  4. --! Use the niosII library for all processor system components
  5. library niosII;
  6. --! Use the pll_200 library for the PLL 200 MHz clock generation
  7. library pll_main;
  8. entity signal_processing is
  9. port
  10. (
  11. clk_input : in std_logic;
  12. reset_n : in std_logic;
  13. --! Push button key_0 used to start a single execution of the signal
  14. --! processing.
  15. key_start : in std_logic;
  16. leds : out std_logic_vector( 7 downto 0 )
  17. );
  18. end entity signal_processing;
  19. architecture struct of signal_processing is
  20. --! input clock synchronous reset
  21. signal sync_reset : std_logic;
  22. --! main clock for the NiosII system
  23. signal clk_main : std_logic;
  24. --! main clock from PLL is locked and the system reset can be released.
  25. signal locked_main : std_logic;
  26. --! main clock synchronous reset
  27. signal sync_reset_main : std_logic;
  28. signal sync_reset_main_n : std_logic;
  29. signal sw_leds : std_logic_vector( 7 downto 0 );
  30. signal hw_leds : std_logic_vector( 7 downto 0 );
  31. signal hardware_task_0_address : std_logic_vector(3 downto 0);
  32. signal hardware_task_0_read : std_logic;
  33. signal hardware_task_0_readdata : std_logic_vector(31 downto 0);
  34. signal hardware_task_0_write : std_logic;
  35. signal hardware_task_0_writedata : std_logic_vector(31 downto 0);
  36. signal hardware_task_1_address : std_logic_vector(3 downto 0);
  37. signal hardware_task_1_read : std_logic;
  38. signal hardware_task_1_readdata : std_logic_vector(31 downto 0);
  39. signal hardware_task_1_write : std_logic;
  40. signal hardware_task_1_writedata : std_logic_vector(31 downto 0);
  41. signal hardware_task_2_address : std_logic_vector(3 downto 0);
  42. signal hardware_task_2_read : std_logic;
  43. signal hardware_task_2_readdata : std_logic_vector(31 downto 0);
  44. signal hardware_task_2_write : std_logic;
  45. signal hardware_task_2_writedata : std_logic_vector(31 downto 0);
  46. signal hardware_task_3_address : std_logic_vector(3 downto 0);
  47. signal hardware_task_3_read : std_logic;
  48. signal hardware_task_3_readdata : std_logic_vector(31 downto 0);
  49. signal hardware_task_3_write : std_logic;
  50. signal hardware_task_3_writedata : std_logic_vector(31 downto 0);
  51. signal hardware_task_4_address : std_logic_vector(3 downto 0);
  52. signal hardware_task_4_read : std_logic;
  53. signal hardware_task_4_readdata : std_logic_vector(31 downto 0);
  54. signal hardware_task_4_write : std_logic;
  55. signal hardware_task_4_writedata : std_logic_vector(31 downto 0);
  56. signal hardware_task_5_address : std_logic_vector(3 downto 0);
  57. signal hardware_task_5_read : std_logic;
  58. signal hardware_task_5_readdata : std_logic_vector(31 downto 0);
  59. signal hardware_task_5_write : std_logic;
  60. signal hardware_task_5_writedata : std_logic_vector(31 downto 0);
  61. signal hardware_task_6_address : std_logic_vector(3 downto 0);
  62. signal hardware_task_6_read : std_logic;
  63. signal hardware_task_6_readdata : std_logic_vector(31 downto 0);
  64. signal hardware_task_6_write : std_logic;
  65. signal hardware_task_6_writedata : std_logic_vector(31 downto 0);
  66. signal data_channel_0_hw_sink_write : std_logic;
  67. signal data_channel_0_hw_sink_writedata : std_logic_vector(31 downto 0);
  68. signal data_channel_0_hw_source_read : std_logic;
  69. signal data_channel_0_hw_source_readdata : std_logic_vector(31 downto 0);
  70. signal data_channel_1_hw_sink_write : std_logic;
  71. signal data_channel_1_hw_sink_writedata : std_logic_vector(31 downto 0);
  72. signal data_channel_1_hw_source_read : std_logic;
  73. signal data_channel_1_hw_source_readdata : std_logic_vector(31 downto 0);
  74. signal data_channel_2_hw_sink_write : std_logic;
  75. signal data_channel_2_hw_sink_writedata : std_logic_vector(31 downto 0);
  76. signal data_channel_2_hw_source_read : std_logic;
  77. signal data_channel_2_hw_source_readdata : std_logic_vector(31 downto 0);
  78. signal data_channel_3_hw_sink_write : std_logic;
  79. signal data_channel_3_hw_sink_writedata : std_logic_vector(31 downto 0);
  80. signal data_channel_3_hw_source_read : std_logic;
  81. signal data_channel_3_hw_source_readdata : std_logic_vector(31 downto 0);
  82. signal data_channel_4_hw_sink_write : std_logic;
  83. signal data_channel_4_hw_sink_writedata : std_logic_vector(31 downto 0);
  84. signal data_channel_4_hw_source_read : std_logic;
  85. signal data_channel_4_hw_source_readdata : std_logic_vector(31 downto 0);
  86. signal data_channel_5_hw_sink_write : std_logic;
  87. signal data_channel_5_hw_sink_writedata : std_logic_vector(31 downto 0);
  88. signal data_channel_5_hw_source_read : std_logic;
  89. signal data_channel_5_hw_source_readdata : std_logic_vector(31 downto 0);
  90. signal data_channel_6_hw_sink_write : std_logic;
  91. signal data_channel_6_hw_sink_writedata : std_logic_vector(31 downto 0);
  92. signal data_channel_6_hw_source_read : std_logic;
  93. signal data_channel_6_hw_source_readdata : std_logic_vector(31 downto 0);
  94. begin
  95. -- Synchronize the external reset to the external clock domain
  96. u_sync_rst_50: entity work.sync_rst
  97. port map
  98. (
  99. clk => clk_input,
  100. reset => not reset_n,
  101. rst_sync => sync_reset
  102. );
  103. -- PLL for the main system clock
  104. u_pll_main: entity pll_main.pll_main
  105. port map
  106. (
  107. refclk => clk_input, -- in std_logic
  108. rst => sync_reset, -- in std_logic
  109. outclk_0 => clk_main, -- out std_logic
  110. locked => locked_main -- out std_logic
  111. );
  112. -- Synchronize the main reset to the main clock domain
  113. u_sync_rst_main: entity work.sync_rst
  114. port map
  115. (
  116. clk => clk_main,
  117. reset => not locked_main and sync_reset,
  118. rst_sync => sync_reset_main
  119. );
  120. sync_reset_main_n <= not sync_reset_main;
  121. -- NiosII system
  122. u_niosII : entity niosii.niosII
  123. port map
  124. (
  125. clk_clk => clk_main,
  126. reset_reset_n => sync_reset_main_n,
  127. key_start_export => key_start,
  128. leds_export => sw_leds,
  129. data_channel_0_hw_sink_write => data_channel_0_hw_sink_write,
  130. data_channel_0_hw_sink_writedata => data_channel_0_hw_sink_writedata,
  131. data_channel_0_hw_source_read => data_channel_0_hw_source_read,
  132. data_channel_0_hw_source_readdata => data_channel_0_hw_source_readdata,
  133. data_channel_1_hw_sink_write => data_channel_1_hw_sink_write,
  134. data_channel_1_hw_sink_writedata => data_channel_1_hw_sink_writedata,
  135. data_channel_1_hw_source_read => data_channel_1_hw_source_read,
  136. data_channel_1_hw_source_readdata => data_channel_1_hw_source_readdata,
  137. data_channel_2_hw_sink_write => data_channel_2_hw_sink_write,
  138. data_channel_2_hw_sink_writedata => data_channel_2_hw_sink_writedata,
  139. data_channel_2_hw_source_read => data_channel_2_hw_source_read,
  140. data_channel_2_hw_source_readdata => data_channel_2_hw_source_readdata,
  141. data_channel_3_hw_sink_write => data_channel_3_hw_sink_write,
  142. data_channel_3_hw_sink_writedata => data_channel_3_hw_sink_writedata,
  143. data_channel_3_hw_source_read => data_channel_3_hw_source_read,
  144. data_channel_3_hw_source_readdata => data_channel_3_hw_source_readdata,
  145. data_channel_4_hw_sink_write => data_channel_4_hw_sink_write,
  146. data_channel_4_hw_sink_writedata => data_channel_4_hw_sink_writedata,
  147. data_channel_4_hw_source_read => data_channel_4_hw_source_read,
  148. data_channel_4_hw_source_readdata => data_channel_4_hw_source_readdata,
  149. data_channel_5_hw_sink_write => data_channel_5_hw_sink_write,
  150. data_channel_5_hw_sink_writedata => data_channel_5_hw_sink_writedata,
  151. data_channel_5_hw_source_read => data_channel_5_hw_source_read,
  152. data_channel_5_hw_source_readdata => data_channel_5_hw_source_readdata,
  153. data_channel_6_hw_sink_write => data_channel_6_hw_sink_write,
  154. data_channel_6_hw_sink_writedata => data_channel_6_hw_sink_writedata,
  155. data_channel_6_hw_source_read => data_channel_6_hw_source_read,
  156. data_channel_6_hw_source_readdata => data_channel_6_hw_source_readdata,
  157. hardware_task_0_task_address => hardware_task_0_address,
  158. hardware_task_0_task_read => hardware_task_0_read,
  159. hardware_task_0_task_readdata => hardware_task_0_readdata,
  160. hardware_task_0_task_write => hardware_task_0_write,
  161. hardware_task_0_task_writedata => hardware_task_0_writedata,
  162. hardware_task_1_task_address => hardware_task_1_address,
  163. hardware_task_1_task_read => hardware_task_1_read,
  164. hardware_task_1_task_readdata => hardware_task_1_readdata,
  165. hardware_task_1_task_write => hardware_task_1_write,
  166. hardware_task_1_task_writedata => hardware_task_1_writedata,
  167. hardware_task_2_task_address => hardware_task_2_address,
  168. hardware_task_2_task_read => hardware_task_2_read,
  169. hardware_task_2_task_readdata => hardware_task_2_readdata,
  170. hardware_task_2_task_write => hardware_task_2_write,
  171. hardware_task_2_task_writedata => hardware_task_2_writedata,
  172. hardware_task_3_task_address => hardware_task_3_address,
  173. hardware_task_3_task_read => hardware_task_3_read,
  174. hardware_task_3_task_readdata => hardware_task_3_readdata,
  175. hardware_task_3_task_write => hardware_task_3_write,
  176. hardware_task_3_task_writedata => hardware_task_3_writedata,
  177. hardware_task_4_task_address => hardware_task_4_address,
  178. hardware_task_4_task_read => hardware_task_4_read,
  179. hardware_task_4_task_readdata => hardware_task_4_readdata,
  180. hardware_task_4_task_write => hardware_task_4_write,
  181. hardware_task_4_task_writedata => hardware_task_4_writedata,
  182. hardware_task_5_task_address => hardware_task_5_address,
  183. hardware_task_5_task_read => hardware_task_5_read,
  184. hardware_task_5_task_readdata => hardware_task_5_readdata,
  185. hardware_task_5_task_write => hardware_task_5_write,
  186. hardware_task_5_task_writedata => hardware_task_5_writedata,
  187. hardware_task_6_task_address => hardware_task_6_address,
  188. hardware_task_6_task_read => hardware_task_6_read,
  189. hardware_task_6_task_readdata => hardware_task_6_readdata,
  190. hardware_task_6_task_write => hardware_task_6_write,
  191. hardware_task_6_task_writedata => hardware_task_6_writedata
  192. );
  193. u_task_sine: entity work.task_sine
  194. port map (
  195. clk => clk_main,
  196. reset => sync_reset_main,
  197. address => hardware_task_0_address,
  198. read => hardware_task_0_read,
  199. readdata => hardware_task_0_readdata,
  200. write => hardware_task_0_write,
  201. writedata => hardware_task_0_writedata,
  202. signal_write => data_channel_0_hw_sink_write ,
  203. signal_writedata => data_channel_0_hw_sink_writedata
  204. );
  205. u_task_cosine: entity work.task_sine
  206. port map (
  207. clk => clk_main,
  208. reset => sync_reset_main,
  209. address => hardware_task_1_address,
  210. read => hardware_task_1_read,
  211. readdata => hardware_task_1_readdata,
  212. write => hardware_task_1_write,
  213. writedata => hardware_task_1_writedata,
  214. signal_write => data_channel_1_hw_sink_write ,
  215. signal_writedata => data_channel_1_hw_sink_writedata
  216. );
  217. u_task_rand: entity work.task_rand
  218. port map (
  219. clk => clk_main,
  220. reset => sync_reset_main,
  221. address => hardware_task_2_address,
  222. read => hardware_task_2_read,
  223. readdata => hardware_task_2_readdata,
  224. write => hardware_task_2_write,
  225. writedata => hardware_task_2_writedata,
  226. signal_write => data_channel_2_hw_sink_write ,
  227. signal_writedata => data_channel_2_hw_sink_writedata
  228. );
  229. u_task_add_sine_cosine: entity work.task_add
  230. port map (
  231. clk => clk_main,
  232. reset => sync_reset_main,
  233. address => hardware_task_3_address,
  234. read => hardware_task_3_read,
  235. readdata => hardware_task_3_readdata,
  236. write => hardware_task_3_write,
  237. writedata => hardware_task_3_writedata,
  238. signal_a_read => data_channel_0_hw_source_read,
  239. signal_a_readdata => data_channel_0_hw_source_readdata,
  240. signal_b_read => data_channel_1_hw_source_read,
  241. signal_b_readdata => data_channel_1_hw_source_readdata,
  242. signal_write => data_channel_3_hw_sink_write ,
  243. signal_writedata => data_channel_3_hw_sink_writedata
  244. );
  245. u_task_add_rand: entity work.task_add
  246. port map (
  247. clk => clk_main,
  248. reset => sync_reset_main,
  249. address => hardware_task_4_address,
  250. read => hardware_task_4_read,
  251. readdata => hardware_task_4_readdata,
  252. write => hardware_task_4_write,
  253. writedata => hardware_task_4_writedata,
  254. signal_a_read => data_channel_2_hw_source_read,
  255. signal_a_readdata => data_channel_2_hw_source_readdata,
  256. signal_b_read => data_channel_3_hw_source_read,
  257. signal_b_readdata => data_channel_3_hw_source_readdata,
  258. signal_write => data_channel_4_hw_sink_write ,
  259. signal_writedata => data_channel_4_hw_sink_writedata
  260. );
  261. u_task_fft: entity work.task_fft
  262. port map (
  263. clk => clk_main,
  264. reset => sync_reset_main,
  265. address => hardware_task_5_address,
  266. read => hardware_task_5_read,
  267. readdata => hardware_task_5_readdata,
  268. write => hardware_task_5_write,
  269. writedata => hardware_task_5_writedata,
  270. signal_read => data_channel_4_hw_source_read,
  271. signal_readdata => data_channel_4_hw_source_readdata,
  272. signal_write => data_channel_5_hw_sink_write ,
  273. signal_writedata => data_channel_5_hw_sink_writedata
  274. );
  275. u_task_crc: entity work.task_crc
  276. port map (
  277. clk => clk_main,
  278. reset => sync_reset_main,
  279. address => hardware_task_6_address,
  280. read => hardware_task_6_read,
  281. readdata => hardware_task_6_readdata,
  282. write => hardware_task_6_write,
  283. writedata => hardware_task_6_writedata,
  284. signal_read => data_channel_5_hw_source_read,
  285. signal_readdata => data_channel_5_hw_source_readdata,
  286. signal_write => data_channel_6_hw_sink_write ,
  287. signal_writedata => data_channel_6_hw_sink_writedata
  288. );
  289. hw_leds <= ( 0 => reset_n, 1 => sync_reset, 2 => locked_main, 3 => sync_reset_main, others => '0' );
  290. leds <= sw_leds or hw_leds;
  291. end architecture struct;