VHDL Waveform Simulation with Modified Input Sequence | ModelSim Tutorial"

  • Thread starter Thread starter mr_coffee
  • Start date Start date
  • Tags Tags
    Form Wave
Click For Summary
SUMMARY

This discussion focuses on modifying the input sequence for a VHDL simulation using ModelSim, specifically for a full adder. The user was tasked with changing the "testadder.vhd" file to simulate a full adder with a gray code input sequence: 000 -> 001 -> 011 -> 010 -> 110 -> 111 -> 101 -> 100 -> 000. The user provided modified VHDL code and waveform output, while also clarifying that transitions between input signals must occur at least 10 nanoseconds apart.

PREREQUISITES
  • Understanding of VHDL syntax and structure
  • Familiarity with ModelSim simulation environment
  • Knowledge of full adder logic and gray code sequences
  • Basic concepts of signal timing in digital circuits
NEXT STEPS
  • Explore VHDL simulation techniques in ModelSim
  • Learn about gray code and its applications in digital design
  • Study the implementation of timing constraints in VHDL
  • Investigate advanced VHDL constructs for signal manipulation
USEFUL FOR

Students and professionals in digital design, VHDL developers, and anyone looking to enhance their skills in waveform simulation and full adder implementations using ModelSim.

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:

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K