uart: make baudrate a generic

This commit is contained in:
Paul Mathieu 2021-07-25 23:50:09 -07:00
parent 1d36528b2c
commit 1d69c453a8

View File

@ -3,6 +3,11 @@ use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity uart is
generic
(
baudrate : in natural := 1_000_000
);
port
(
clk : in std_logic;
@ -32,7 +37,7 @@ end uart;
-- Mnemonic: receive from the left, transmit to the right
architecture Behavioral of uart is
constant BAUD: positive := 1_000_000;
constant BAUD: positive := baudrate;
constant SYSFREQ: natural := 100_000_000;
constant CLKCNT: natural := SYSFREQ / BAUD;