![]() |
sponsored links |
|
|
sponsored links
|
|
|
2
10th July 04:01
External User
Posts: 1
|
Delta times are needed for simulation to emulate concurrency.
Care must be taken when using variable to avoid code that is harder to read, and is confusing. In the example below, variable V is used both as a FF and as a temporary variable. This is very poor style. If you use a variable as a temporary, assigning before reading it. If you using as a FF, then avaoid reusing it as a temporary, implying combinational logic. Problem_proc: process (clk, reset_n) is variable v : std_logic; begin -- process Problem_proc if reset_n = '0' then -- asynchronous reset (active low) s1 <= '0'; s2 <= '0'; elsif clk'event and clk = '1' then -- rising clock edge s1 <= v; -- v is a FF since it holds old value v := s3 and s4; -- v is a temp s2 <= s1 and v; -- v is a temp here, equal to (s3 and s4) v := s2; -- v is a FF since it must hold value till next clock end if; end process Problem_proc; On another related topic, avoid using "wait for 0 ns; " ,unless absolutely necessary (like my switch model. If you must resort to "wait for 0 ns;" in your TB, then you are using a very poor style. ---------------------------------------------------------------------------- Ben Cohen Publisher, Trainer, Consultant (310) 721-4830 http://www.vhdlcohen.com/ vhdlcohen@aol.com Author of following textbooks: * Using PSL/SUGAR with Verilog and VHDL Guide to Property Specification Language for ABV, 2003 isbn 0-9705394-4-4 * Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn 0-9705394-2-8 * Component Design by Example ", 2001 isbn 0-9705394-0-1 * VHDL Coding Styles and Methodologies, 2nd Edition, 1999 isbn 0-7923-8474-1 * VHDL Answers to Frequently Asked Questions, 2nd Edition, isbn 0-7923-8115 ------------------------------------------------------------------------------ |
|