]> rtime.felk.cvut.cz Git - fpga/uart.git/commitdiff
Early initialization of all relevant signals.
authorVladimir Burian <buriavl2@fel.cvut.cz>
Wed, 18 May 2011 19:37:06 +0000 (21:37 +0200)
committerVladimir Burian <buriavl2@fel.cvut.cz>
Wed, 18 May 2011 19:37:06 +0000 (21:37 +0200)
Now it is not required to do reset after start-up.

baud_gen.vhd
fifo.vhd
rx.vhd
rx_control.vhd
tx.vhd
tx_control.vhd
uart.vhd

index 81dfa5cab9fa14f23dbfcbd0bdac363e08888ffb..f3312f0c66cd0df1b75980ecbcc71339dc6ccc8b 100644 (file)
@@ -47,8 +47,8 @@ end baud_gen;
 
 architecture behavioral of baud_gen is
 
-  signal counter    : std_logic_vector (SCALE_WIDTH-1 downto 0);
-  signal clk_baud_s : std_logic;
+  signal counter    : std_logic_vector (SCALE_WIDTH-1 downto 0) := (others => '0');
+  signal clk_baud_s : std_logic := '0';
 
 --------------------------------------------------------------------------------
 
index ae3ca9e0b390ec336d5c30783bc37044a69b1334..f59a43826c466a01176fe8b0d6be39d0c3158d27 100644 (file)
--- a/fifo.vhd
+++ b/fifo.vhd
@@ -33,7 +33,7 @@ entity fifo is
     full     : out std_logic;  -- fifo is full
     hfull    : out std_logic;  -- fifo is half full
     empty    : out std_logic;  -- fifo is empty
-    overflow : out std_logic
+    overflow : out std_logic := '0'
   );
 end fifo;
 
@@ -46,10 +46,10 @@ architecture behavioral of fifo is
 
   signal memory : mem_t;
   
-  signal read_addr : mem_addr_t;
-  signal write_addr : mem_addr_t;
+  signal read_addr : mem_addr_t := (others => '0');
+  signal write_addr : mem_addr_t := (others => '0');
 
-  signal length : std_logic_vector (width downto 0);
+  signal length : std_logic_vector (width downto 0) := (others => '0');
 
   signal full_s : std_logic;
 
diff --git a/rx.vhd b/rx.vhd
index 11dc9d9d478f5bdd034c0c50275d485706db98cd..db1c13246b2516daa90266fe18bc65ae45661d20 100644 (file)
--- a/rx.vhd
+++ b/rx.vhd
@@ -32,8 +32,8 @@ entity receiver is
     en            : in  std_logic;
     rx            : in  std_logic;
     ready         : out std_logic;
-    bad_start_bit : out std_logic;
-    bad_stop_bit  : out std_logic;
+    bad_start_bit : out std_logic := '0';
+    bad_stop_bit  : out std_logic := '0';
     data          : out std_logic_vector (7 downto 0));
 end entity receiver;
 
@@ -43,8 +43,8 @@ architecture behavioral of receiver is
   
   signal rx_shift_reg : std_logic_vector (9 downto 0);
   signal rx_flag      : std_logic_vector (9 downto 0);
-  signal rx_ready     : std_logic;
-  signal rx_running   : std_logic;
+  signal rx_ready     : std_logic := '1';
+  signal rx_running   : std_logic := '0';
   
 --------------------------------------------------------------------------------
   
index ad10c6dd8b074f9b546536e37d428aee3f39dea1..80904fad877aa8be22a985717cf8191dc88c375f 100644 (file)
@@ -11,10 +11,10 @@ entity rx_control is
     bad_start_bit : in  std_logic;
     bad_stop_bit  : in  std_logic;
     rx_ready      : in  std_logic;
-    rx_reset      : out std_logic;
-    rx_en         : out std_logic;
-    fifo_we       : out std_logic;
-    clk_en        : out std_logic);
+    rx_reset      : out std_logic := '0';
+    rx_en         : out std_logic := '0';
+    fifo_we       : out std_logic := '0';
+    clk_en        : out std_logic := '0');
 end entity rx_control;
 
 --------------------------------------------------------------------------------
@@ -23,7 +23,7 @@ architecture behavioral of rx_control is
 
   type state_t is (resetting, waiting, next_frame, receiving);
 
-  signal state : state_t;
+  signal state : state_t := waiting;
 
 --------------------------------------------------------------------------------
 
diff --git a/tx.vhd b/tx.vhd
index ccf9a86e3f6468204607b510df53a7ffbb6cb287..278d6b811761f543c6e3b1247e7ae1ec6a2f2185 100644 (file)
--- a/tx.vhd
+++ b/tx.vhd
@@ -32,12 +32,12 @@ end transmitter;
 architecture behavioral of transmitter is
   
   -- Output shift register (containing also start and stop bit).
-  signal tx_shift_reg : std_logic_vector (9 downto 0);
+  signal tx_shift_reg : std_logic_vector (9 downto 0) := "1111111111";
   -- Register parallel to the output shift register where '1' shows the last
   -- bit of the frame ('1' is in the place of stop bit).
-  signal tx_flag      : std_logic_vector (9 downto 0);
+  signal tx_flag      : std_logic_vector (9 downto 0) := "0000000000";
   -- Transmitting of new frame could be started with next clk.
-  signal tx_ready     : std_logic;
+  signal tx_ready     : std_logic := '1';
 
 --------------------------------------------------------------------------------
 
index d7c4f25847924a79056a5445510b4a8764cc8e6e..f3294c99dc44bbc53e55ebd4b094b59e93ab0763 100644 (file)
@@ -27,7 +27,7 @@ architecture behavioral of tx_control is
   
   type state_t is (waiting, next_frame, transmitting);
   
-  signal state : state_t;
+  signal state : state_t := waiting;
 
 --------------------------------------------------------------------------------
 
index 11eb9b243eae781c3ff2992d55ed25dd411ab510..09450f91f1bc0ada7428853220b7ad17ca45573b 100644 (file)
--- a/uart.vhd
+++ b/uart.vhd
@@ -129,9 +129,9 @@ architecture dataflow of uart is
   signal reg_re_b : boolean_vector (512 downto 0);
 
   
-  signal reg_baud : std_logic_vector (15 downto 0) := "0000000000000010";
+  signal reg_baud : std_logic_vector (15 downto 0) := (others => '0');
   signal reg_stat : std_logic_vector (7 downto 0);
-  signal reg_ie   : std_logic_vector (7 downto 0);
+  signal reg_ie   : std_logic_vector (7 downto 0) := (others => '0');
 
   
   signal tx_clk        : std_logic;