• No results found

Laboration i digital konstruktion I: Lab 1

N/A
N/A
Protected

Academic year: 2021

Share "Laboration i digital konstruktion I: Lab 1"

Copied!
2
0
0

Loading.... (view fulltext now)

Full text

(1)

Sida 1 av 2

Laboration i digital konstruktion I: Lab 1

1.0 First design : Adderare

1.1 Purpose

This lab-exercise shows how VHDL can be used in different ways to describe the same functionality and how the different descriptions can be verified in the same testbench.

1.2 Preparations

cd ~/VHDL mkdir lab1 cd lab1 qhlib work

cp ~kurser/digkon1/lab/VHDL_kod/add8_tb.vhdl .

1.3 To do

1.3.1 Write a synthesizable model for an 1-bit full-adder (fa) in the text-editor emacs. Name the file fa.vhdl

The modul-interface should be like:

entity fa is

port ( a, b, cin : in std_logic;

s, cout : out std_logic);

end fa;

The data type std_logic is defined in IEEE.STD_LOGIC_1164.

1.3.2 Simulate the full-adder

Compile the source-code (fa.vhdl)

qvhcom fa.vhdl

start the simulator

qhsim

Verify the full-adder by simulating all combinations on the inputs.

1.3.3 Structural description of an 8-bit adder a

b cin

s cout

(2)

Laboration i digital konstruktion I: Lab 1

sida 2 av 2

Construct a structural description of an 8-bit adder (add8) by using the previously designed full-adder. By connecting the eight 1-bit adders we build an adder capable of adding two 8-bit numbers.

1.3.4 The modul-interface should be like:

entity add8 is

port ( a, b : in std_logic_vector(7 downto 0);

cin : in std_logic;

s : out std_logic_vector(7 downto 0);

cout : out std_logic);

end add8;

Since we are going to write two descriptions of add8 where the module- interface shall be identical (i.e. the entity declaration) we put the entity

declaration in a separate file. Name the file r add8_entity.vhdl. Write the structural description of add8, name the architecture struct, and save it in a file called add8_struct.vhdl.

1.3.5 Verify the structural description

Compile add8_struct.vhdl and read it into the simulator to test a couple of combinations of the inputs, just to do a quick test to see if it works at all.

1.3.6 Write a synthesizable behavioural description of add8.

Name the architecture rtl and save the file in add8_rtl.vhdl. The addition is made by the + sign.

1.3.7 Verify the behavioural description

Compile add8_rtl.vhdl and read it into the simulator to test a couple of combinations of the inputs, just to do a quick test to see if it works at all.

1.3.8 Verify that the structural description and the behavioural description are equivalent.

Open the testbench-file add8_tb.vhdl in emacs. Explain what is does.

Compile add8_tb.vhdl and read it into the simulator. Simulate. What hap- pens ?

1.4 Report

Answer the questaions, include VHDL-code results from simulations, demon- strate your designs for the lab. assistant.

cout cin

a b

s

a(7) b(7)

s(7)

c(7) cout cin

a b

s

a(6) b(6)

s(6)

c(6) cout cin

a b

s

a(5) b(5)

s(5)

c(5) cout cin

a b

s

a(4) b(4)

s(4)

c(4) cout cin

a b

s

a(3) b(3)

s(3)

c(3) cout cin

a b

s

a(2) b(2)

s(2)

c(2) cout cin

a b

s

a(1) b(1)

s(1)

c(1) cout

a b

s

a(0) b(0)

s(0)

cout cin 0

References

Related documents

If you bike every day to the lab, you reduce your emissions with 1200 kg/year, compared to a petrol-driven car (10 km one way).. DID

Furthermore we can conclude in this report that, since the PLC is so different from case to case, it is hard to make one specific model that is applicable to all. If a company is

The concepts behind a potential digital tool that could be used for placing IT forensic orders have been evaluated using a grounded theory approach.. It is important to take

The EU exports of waste abroad have negative environmental and public health consequences in the countries of destination, while resources for the circular economy.. domestically

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

The increasing availability of data and attention to services has increased the understanding of the contribution of services to innovation and productivity in

alternatives, tools, education, everyday, trickster, table, norm criticism, present, future, play, system, table, pho- tography, storytelling, discussion, design.. The thesis

I ALU_lab.vhdl finns grunden till VHDL beskrivningen som ska kompletteras samt anpassningar för att kunna använda ALU:n på prototypkortet.. 1.4 Funktionell beskrivning