VHDL Waveform Simulation with Modified Input Sequence | ModelSim Tutorial"

  • Thread starter mr_coffee
  • Start date
  • Tags
    Form Wave
In summary, students are discussing their progress with using VHDL and ModelSim for a project. One student is unsure if they completed the assignment correctly, which was to modify the input sequence for a full adder using gray code. The code for the adder and test values are provided, along with the directions and assumptions for the input signals. The conversation ends with a student admitting they are still new to VHDL and unsure of some of the code.
  • #1
mr_coffee
1,629
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
  • #2
Sorry, I'm not tracking. You are adding a+b+c and getting the 2-bit sum what?
 
  • #3
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:

Related to VHDL Waveform Simulation with Modified Input Sequence | ModelSim Tutorial"

1. What is a VHDL waveform?

A VHDL waveform is a graphical representation of the behavior of signals in a digital circuit. It shows the values of signals over time, allowing designers to analyze and debug their designs.

2. How do I create a VHDL waveform?

To create a VHDL waveform, you need to simulate your VHDL code using a simulation tool such as ModelSim or Quartus. The simulation results will then be displayed as a waveform, which can be viewed and analyzed.

3. Why is it important to check my VHDL waveform?

Checking your VHDL waveform is important because it allows you to verify the functionality of your design and catch any errors or bugs before implementing it in hardware. It also helps in understanding the behavior of your circuit and making any necessary improvements.

4. How do I interpret a VHDL waveform?

Interpreting a VHDL waveform involves understanding the different signals displayed in the waveform, such as inputs, outputs, and internal signals. By looking at the values of these signals over time, you can analyze the behavior of your circuit and identify any issues.

5. Can I use a VHDL waveform for any type of digital circuit?

Yes, a VHDL waveform can be used for any type of digital circuit, as long as it is written in VHDL code. It is a universal tool for testing and debugging digital circuits, regardless of their complexity or application.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
Replies
2
Views
14K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
3K
Back
Top