Generic and generic map | total time delay for each files

vhdl

In adder.vhd

  H1: half_Adder generic map ( gate_delay => 6 ns );      
  port map ( a => ln1, b => ln2, ... );

half_adder.vhd

  Ex1 : xor generic map ( gate_delay => gate_delay );
  A1  : and generic map ( gate_delay => gate_delay );

and.vhd

  entity and is generic ( gate_delay : Time := 2 ns );

xor.vhd

  entity xor is generic ( gate_delay : Time := 3 ns );

I gave four files.

My question is, how much should one wait to see correct result ? In other words, what is the total time delay for each file?

Best Answer

Since the longest path in a half adder is only one gate, the delay of the entire circuit will be equal to the gate delay. In this case, the gate delay is 6 ns. The default values for gate_delay of both gate entities are overridden in the instantiations you write.

Note that your code will not work since and and xor are reserved words in VHDL. You will need to rename to something like and_gate and xor_gate

Another side note: VHDL code like this is only used for gate level simulation with timing annotations, usually after synthesis and place and route. If you want to write an adder in VHDL, you should write a <= b + c;