VHDL Waveform Simulation with Modified Input Sequence | ModelSim Tutorial"

  • Thread starter Thread starter mr_coffee
  • Start date Start date
  • Tags Tags
    Form Wave
AI Thread Summary
The discussion focuses on modifying a VHDL testbench for a full adder simulation using ModelSim. The task requires changing the input sequence to a gray code format while adhering to a minimum transition time of 10 nanoseconds between signal changes. The provided code includes the architecture for both the full adder and the testbench, with specific timing for input signals a, b, and ci. There is some confusion regarding the assignment, particularly about whether to alter the full adder code or just the input values. The user seeks clarification on the requirements and the expected output of the simulation.
mr_coffee
Messages
1,613
Reaction score
1
Hello everyone.

We just started VHDL using ModelSim and I want to make sure i did this right. The assignment was to:
Modify the Input Sequence. Once you complete the simulation with the given VHDL files, you are requred to moidfy the file "testadder.vhd" to simulate the full adder using the gray code input sequence.


a,b,cin: 000 -> 001 -> 011 -> 010 -> 110 -> 111 -> 101 -> 100 -> 000


Assume for each input signal, a transition (from 0 to 1 or from 1 to 0) is only allowed after at least 10 nanoseconds from the previous transition.

here is the code I modified:
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity testadder is 
end testadder;

architecture testbench of testadder is
signal a,b,ci,s,co:std_logic;

component fulladder
port(
   a:in std_logic;
   b:in std_logic;
   ci:in std_logic;
   co:out std_logic;
   s:out std_logic);
end component;

begin
add:	fulladder PORT MAP(a=>a,b=>b,ci=>ci,s=>s,co=>co);
	a<='0','1' after 40 ns, '0' after 80ns;
	b<='0','1' after 20 ns, '0' after 60ns;
	ci<='0','1' after 10 ns, '0' after 30ns, '1' after 50ns, '0' after 70ns;
end testbench;

and here is the wave form:
http://suprfile.com/src/1/3ul55mx/CorySanchezWave.gif
 
Last edited by a moderator:
Physics news on Phys.org
Sorry, I'm not tracking. You are adding a+b+c and getting the 2-bit sum what?
 
I guess its a full adder... but she didnt want us to mess around with the full adder code, she just wanted us to change the input values of the full adder.

Here is all the code:
this is the add.vhd
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity fulladder is 
Port(
   a:in std_logic;
   b:in std_logic;
   ci:in std_logic;
   s:out std_logic;
   co:out std_logic);
end fulladder;

architecture behavior of fulladder is
begin
	s <= a xor b xor ci;
	co <= (a and b) or (a and ci) or (b and ci);
end behavior;

Here is the test values the adder is getting:
Code:
use IEEE.STD_LOGIC_1164.ALL;

entity testadder is 
end testadder;

architecture testbench of testadder is
signal a,b,ci,s,co:std_logic;

component fulladder
port(
   a:in std_logic;
   b:in std_logic;
   ci:in std_logic;
   co:out std_logic;
   s:out std_logic);
end component;

begin
add:	fulladder PORT MAP(a=>a,b=>b,ci=>ci,s=>s,co=>co);
	a<='0','1' after 40 ns, '0' after 80ns;
	b<='0','1' after 20 ns, '0' after 60ns;
	ci<='0','1' after 10 ns, '0' after 30ns, '1' after 50ns, '0' after 70ns;
end testbench;

The directions where:
Modify the Input Sequence. Once you complete the simulation with the given VHDL files, you are requred to moidfy the file "testadder.vhd" to simulate the full adder using the gray code input sequence.a,b,cin: 000 -> 001 -> 011 -> 010 -> 110 -> 111 -> 101 -> 100 -> 000Assume for each input signal, a transition (from 0 to 1 or from 1 to 0) is only allowed after at least 10 nanoseconds from the previous transition.
I'm still very new and not sure what a lot of this means...but yes there are
Code:
 a:in std_logic;
   b:in std_logic;
   ci:in std_logic;
   co:out std_logic;
   s:out std_logic);
3 input values, a, b, anc ci, and 2 output values, co and s
 
Last edited:
Back
Top