Presentation is loading. Please wait.

Presentation is loading. Please wait.

Step 3 in behavioral modeling. Use of packages.

Similar presentations


Presentation on theme: "Step 3 in behavioral modeling. Use of packages."— Presentation transcript:

1 Step 3 in behavioral modeling. Use of packages.
Project Step 6 Step 3 in behavioral modeling. Use of packages. 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

2 Copyright 2006 - Joanne DeGroat, ECE, OSU
So far Modeled the ALU structurally with dataflow models of the leaf units. Modeled the structure exactly in the first behavioral architecture. Code=Structure 2nd Behavioral model used a combined P&K&R to choose the operation For op A have P,K,R of 1100,1111,1100 For op A AND B have 1000,1111, etc. AND incorporated procedures, declared in the declarative region of the process, for the arithmetic functions. 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

3 Copyright 2006 - Joanne DeGroat, ECE, OSU
This time And yes, this is yet another architecture of our ALU (yaa) Start by declaring a new ENTITY for the 8 bit ALU – (we now need one) NO LONGER HAVE P, K, AND R Now have simply alu_op Illustrated in the assignment writeup and on the next slide 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

4 Copyright 2006 - Joanne DeGroat, ECE, OSU
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 Where is TYPE operations declared? 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

5 Copyright 2006 - Joanne DeGroat, ECE, OSU
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? IT CAN’T -- SO Move the declaration to a PACKAGE that both the testbench ARCHITECTURE and this ENTITY can use it. So declare a package declarative part and package body. TYPE operations is moved to the package declarative part. 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

6 Copyright 2006 - Joanne DeGroat, ECE, OSU
The Procedures The procedures for binary addition, subtraction and two’s complement are also moved to the package. What is needed in the package declarative part??? 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

7 Copyright 2006 - Joanne DeGroat, ECE, OSU
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 … (but the ENTITY also needs TYPE operations) so where is the USE placed? BE SURE TO COMMENT OUT THE DECLARATION for TYPE operations IN THE TESTBENCH ARCHITECTURE 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

8 Copyright 2006 - Joanne DeGroat, ECE, OSU
Type Operations Declare it in both the testbench and the package??? 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!! Which means it does not work. 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

9 Copyright 2006 - Joanne DeGroat, ECE, OSU
Using it in the ENTITY USE work.step6_package.all; ENTITY alu_8bit_v4 IS … PORT ( …………. The USE clause prior to the ENTITY makes all the declarations in this package visible to the ENTITY and all ARCHITECTURES of the ENTITY. 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

10 Copyright 2006 - Joanne DeGroat, ECE, OSU
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. 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU

11 Copyright 2006 - Joanne DeGroat, ECE, OSU
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 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU


Download ppt "Step 3 in behavioral modeling. Use of packages."

Similar presentations


Ads by Google