Using Packages in Behavioral Modeling of an 8-bit ALU: A Step-by-Step Guide, Slides of Computer Aided Design (CAD)

The process of using packages in behavioral modeling of an 8-bit alu, focusing on declaring a new entity for the alu, moving the declaration of type operations and procedures to the package, and making the declarations visible to the entity through a use clause. The document also discusses the importance of understanding the scope of type operations and the benefits of having identical but separate declarations.

Typology: Slides

2012/2013

Uploaded on 05/08/2013

anasuya
anasuya 🇮🇳

4

(9)

85 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Project Step 6
Step 3 in behavioral modeling. Use
of packages.
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Using Packages in Behavioral Modeling of an 8-bit ALU: A Step-by-Step Guide and more Slides Computer Aided Design (CAD) in PDF only on Docsity!

Project Step 6

Step 3 in behavioral modeling. Use

of packages.

So far

  • Modeled the ALU structurally with dataflow

models of the leaf units.

  • Modeled the structure exactly in the first

behavioral architecture. Code=Structure

  • 2 nd^ Behavioral model used a combined P&K&R

to choose the operation

  • For op A have P,K,R of 1100,1111,
  • For op A AND B have 1000,1111,

The new ENTITY

  • ENTITY alu_8bit_v4 IS
  • PORT ( alu_op : IN operations;
  • a,b : IN BIT_VECTOR(7 downto 0);
  • Cin : IN BIT;
  • Zout : OUT BIT_VECTOR(7 downto 0);
  • Cout : OUT BIT);
  • END alu_8bit_v4;
  • Note that this ENTITY uses type operations

Type Operations

  • Type OPERATIONS was declared in the declarative region of the ARCHITECTURE of the testbench.
  • The scope of TYPE operations is limited to the ARCHITECTURE in which it is declared.
  • So how can this ENTITY declaration use it?
  • Move the declaration to a PACKAGE
    • that both the testbench ARCHITECTURE and this ENTITY use.
  • So declare a package declarative part and package body. TYPE operations is moved to the declarative part.

The package and use.

  • As the declaration is now in the package the

testbench architecture must now have a USE clause prior to it so that it can see the declaration.

  • USE work.step6_package.all;
  • ARCHITECTURE test OF p6 IS …

• BE SURE TO COMMENT OUT THE DECLARATION IN

THE TESTBENCH ARCHITECTURE

Type Operations

  • The declaration for type operations in the

testbench and the package would be identical

so why not just have both of them.

  • They are different declarations and therefore a

different type.

The Procedures

  • Also move the procedures declared in the

process declarative region out to the package

body.

  • Add declarations for them in the package

declarative part. (but the code from before

goes in the package body)

  • The declaration can be cut and pasted.

A final modification

  • Modify the case statement to switch on

opu_op instead of the concatenated PKR value

which is no longer even available.

  • And once again
    • Move the declaration for TYPE operations to the package and comment it out in the testbench architecture