TAILIEUCHUNG - VHDL Programming by Example phần 4

Ví dụ, nếu bạn đang thiết kế một CPU, một khối có thể là một ALU, một ngân hàng khác đăng ký, và shifter một. Mỗi khối đại diện cho một khu vực khép kín của mô hình. Mỗi khối có thể khai báo các tín hiệu địa phương, các loại, các hằng số, và như vậy. | 132 Chapter Five TYPE fourvalvector IS ARRAY natural RANGE OF fourval FUNCTION resolve s fourvalvector RETURN fourval SUBTYPE resfour IS resolve fourval END fourpack USE ENTITY mux2 IS PORT i1 i2 a IN fourval q OUT fourval END mux2 ARCHITECTURE different OF mux2 IS COMPONENT and2 PORT a b IN fourval c OUT fourval END COMPONENT COMPONENT inv PORT a IN fourval b OUT fourval END COMPONENT SIGNAL nota fourval -- resolved signal SIGNAL intq resolve fourval X BEGIN U1 inv PORT MAP a nota U2 and2 PORT MAP i1 a intq U3 and2 PORT MAP i2 nota intq q intq END different The package fourpack declares all of the appropriate types and function declarations so that the resolution function resolve is visible in the entity. In the architecture declaration section signal intq is declared of type fourval using the resolution function resolve. This signal is also given an initial value of X. Signal intq is required to have a resolution function because it is the output signal for components U2 and U3. Each component provides a driver to signal intq. Resolution function resolve is used to determine the end result of the two driver values. Signal nota is not required to have a resolution function because it only has one driver component U1. Subprograms and Packages 133 Procedures In the earlier section describing functions we discussed how functions can have a number of input parameters and always return one value. In contrast procedures can have any number of in out and inout parameters. A procedure call is considered a statement of its own a function usually exists as part of an expression. The most usual case of using a procedure is when more than one value is returned. Procedures have basically the same syntax and rules as functions. A procedure declaration begins with the keyword PROCEDURE followed by the procedure name and then an argument list. The main difference between a function and a procedure is that the procedure argument list most likely has a direction .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.