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.

119 lines
5.4 KiB

  1. -- #################################################################################################
  2. -- # << NEORV32 - Example setup including the bootloader, for the Gatemate (c) Eval Board >> #
  3. -- # ********************************************************************************************* #
  4. -- # BSD 3-Clause License #
  5. -- # #
  6. -- # Copyright (c) 2022, Torsten Meissner. All rights reserved. #
  7. -- # #
  8. -- # Redistribution and use in source and binary forms, with or without modification, are #
  9. -- # permitted provided that the following conditions are met: #
  10. -- # #
  11. -- # 1. Redistributions of source code must retain the above copyright notice, this list of #
  12. -- # conditions and the following disclaimer. #
  13. -- # #
  14. -- # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
  15. -- # conditions and the following disclaimer in the documentation and/or other materials #
  16. -- # provided with the distribution. #
  17. -- # #
  18. -- # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
  19. -- # endorse or promote products derived from this software without specific prior written #
  20. -- # permission. #
  21. -- # #
  22. -- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
  23. -- # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
  24. -- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
  25. -- # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
  26. -- # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
  27. -- # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
  28. -- # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
  29. -- # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
  30. -- # OF THE POSSIBILITY OF SUCH DAMAGE. #
  31. -- # ********************************************************************************************* #
  32. -- # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
  33. -- #################################################################################################
  34. library ieee;
  35. use ieee.std_logic_1164.all;
  36. use ieee.numeric_std.all;
  37. library gatemate;
  38. use gatemate.components.all;
  39. entity neorv32_aes is
  40. port (
  41. -- Clock and Reset inputs
  42. clk_i : in std_logic; -- 10 MHz clock
  43. rst_n_i : in std_logic; -- SW3 button
  44. -- LED outputs
  45. led_n_o : out std_logic_vector(7 downto 0);
  46. -- UART0
  47. uart_rx_i : in std_logic; -- PMODA IO
  48. uart_tx_o : out std_logic -- PMODA IO
  49. );
  50. end entity;
  51. architecture rtl of neorv32_aes is
  52. -- configuration --
  53. constant f_clock_c : natural := 26_000_000; -- clock frequency in Hz
  54. -- Globals
  55. signal s_pll_lock : std_logic;
  56. signal s_pll_clk : std_logic;
  57. signal s_cfg_end : std_logic;
  58. signal s_rst_n : std_logic;
  59. signal s_con_pwm : std_logic_vector(2 downto 0);
  60. begin
  61. PLL : CC_PLL
  62. generic map (
  63. REF_CLK => "10",
  64. OUT_CLK => "26",
  65. PERF_MD => "SPEED"
  66. )
  67. port map (
  68. CLK_REF => clk_i,
  69. USR_CLK_REF => '0',
  70. CLK_FEEDBACK => '0',
  71. USR_LOCKED_STDY_RST => '0',
  72. USR_PLL_LOCKED_STDY => open,
  73. USR_PLL_LOCKED => s_pll_lock,
  74. CLK0 => s_pll_clk,
  75. CLK90 => open,
  76. CLK180 => open,
  77. CLK270 => open,
  78. CLK_REF_OUT => open
  79. );
  80. cfg_end : CC_CFG_END
  81. port map (
  82. CFG_END => s_cfg_end
  83. );
  84. s_rst_n <= s_pll_lock and s_cfg_end and rst_n_i;
  85. -- The core of the problem ----------------------------------------------------------------
  86. -- -------------------------------------------------------------------------------------------
  87. neorv32_inst: entity work.neorv32_ProcessorTop_Minimal
  88. generic map (
  89. CLOCK_FREQUENCY => f_clock_c -- clock frequency of s_pll_clk in Hz
  90. )
  91. port map (
  92. -- Global control --
  93. clk_i => std_ulogic(s_pll_clk),
  94. rstn_i => std_ulogic(s_rst_n),
  95. -- PWM (to on-board RGB LED) --
  96. pwm_o => s_con_pwm
  97. );
  98. -- IO Connection --------------------------------------------------------------------------
  99. -- -------------------------------------------------------------------------------------------
  100. led_n_o(4 downto 0) <= (others => '1');
  101. led_n_o(7 downto 5) <= s_con_pwm;
  102. uart_tx_o <= uart_rx_i;
  103. end architecture;