VHDL Interview Question(s)

Murugavel
Written by
3
  1. What are the two key concepts in the simulation semantics of VHDL and how does each concept help VHDL simulation produce waveforms that match the behaviour that we expect?
  2. What is the advantage of RTL simulation in comparison to simulation as defined by the VHDL standard?
  3. What is the disadvantage of RTL simulation in comparison to simulation as defined by the VHDL standard?
  4. For each of the architectures muruku 1. . . muruku 4, answer the following questions.
    • INSTRUCTIONS:
      1. Is the code legal VHDL?
      2. If the code is legal VHDL:
        • Answer whether the behaviour of the signal z has the same behaviour as in the main architecture of sumit.
        • Answer whether the code is synthesizable.
        • If the code is synthesizable, answer whether it adheres to good coding practices.
If the the code is not legal, not synthesizable, or does not follow good coding practices, explain why.

entity sumit is
port (
a, b, clk : in std_logic;
z : out std_logic
);
end sumit;

architecture main of sumit is
signal m : std_logic;
begin
process ( clk )
begin
if rising_edge( clk ) then
m <= a or b; end if; end process; process ( clk ) begin if rising_edge( clk ) then z <= not m; end if; end process; end main;
  1. Muruku 1
    • architecture muruku_1 of sumit is
      signal m : std_logic;
      begin
      process ( clk )
      begin
      if rising_edge( clk ) then
      m <= a or b; z <= not m; end if; end process; end muruku_1;
  2. Muruku_X
    • architecture muruku_X of sumit is
      signal m, p : std_logic;
      begin
      process ( clk )
      begin
      if rising_edge( clk ) then
      m <= a or b; end if; end process; process ( clk ) begin if rising_edge( clk ) then z <= p; end if; end process; p <= not m; end muruku_X;
  3. Muruku_2
    • architecture muruku_2 of sumit is
      signal m, p : std_logic;
      begin
      if (a or b) = ’1’ generate
      m <= ’1’; end generate; if (a or b) = ’0’ generate m <= ’0’; end generate; process ( clk ) begin if rising_edge( clk ) then p <= m; end if; end process; process ( clk ) begin if rising_edge( clk ) then z <= not p; end if; end process; end muruku_2;
  4. Muruku_3
    • architecture muruku_3 of sumit is
      begin
      process
      begin
      wait until rising_edge(clk);
      wait until rising_edge(clk);
      z <= not (a or b); end process; end muruku_3;
  5. Muruku_4
    • architecture muruku_4 of sumit is
      signal m, p : std_logic;
      begin
      process ( clk )
      begin
      if rising_edge( clk ) then
      m <= a or b; end if; end process; process ( clk ) begin if rising_edge( clk ) then p <= m; end if; end process; z <= not p; end muruku_4;
Difficulty: Medium

Post a Comment

3Comments

Your comments will be moderated before it can appear here. Win prizes for being an engaged reader.

  1. hi do you have solutions to this qn? hope to hearfrom you soon,

    sara

    ReplyDelete
  2. Instead of putting up the solution directly i feel it would be better to come up with some intermediate solution which you think of and we can discuss from there...

    ReplyDelete
  3. sumit looks 'crap' but is valid VHDL.
    infers two register, register m, and register z.

    BTW: All have crap layout, DON'T layout your VHDL like this example.

    Muruku 1 will produce the same two registers;

    Muruku X , signal p is outside the process, so imposes a delta, but is valid , and will produce the same,

    Muruku 2, is such crap layout, I'd have to write it out to see what the hell is going on. At first look, the generates seem to be trying to produce the same set of registers, but it's such crazy VHDL I'd have to really study it, which is not the aim of VHDL.

    Muruku 3, again crazy VHDL, the wait until would normally imply you are after a register, but cascaded like that, crazy idea. Who knows what the synthesiser or compiler would do.

    Muruku 4, don't know.

    But I'd say one thing to people that are looking at this.

    The reason for VHDL is to get reliable gates at the end. You want your simulator and synthesiser to get the same output.

    Now simulators are very dumb, sorry to Modelsim et all, but they can and do simulate code that can't be made into chips.

    Synthesisers are / try to be clever. They effectively match 'patterns' in your VHDL to generate the gates / functions they need.

    Learn to write your code in formats that simulators and synthesisers can understand easily. This will save you hours of time. The simulator will agree with the synthesised results, and they will both run faster.

    ReplyDelete
Post a Comment

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn more
Ok, Go it!