174 Chapter Seven
The configuration can also be used to provide a very fast substitution
capability. Multiple architectures can exist for a single entity. One archi-
tecture might be a behavioral model for the entity, while another architec-
ture might be a structural model for the entity. The architecture used in
the containing model can be selected by specifying which architecture to
use in the configuration, and recompiling only the configuration. After
compilation, the simulatable model uses the specified architecture.
Default Configurations
The simplest form of explicit configuration is the default configuration.
(The simplest configuration is none at all in which the last architecture
compiled is used for an entity.) This configuration can be used for models
that do not contain any blocks or components to configure. The default
configuration specifies the configuration name, the entity being configured,
and the architecture to be used for the entity. Following is an
example of two default configurations shown by configurations big_count
and small_count:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
ENTITY counter IS
PORT(load, clear, clk : IN std_logic;
PORT(data_in : IN INTEGER;
PORT(data_out : OUT INTEGER);
END counter;
ARCHITECTURE count_255 OF counter IS
BEGIN
PROCESS(clk)
VARIABLE count : INTEGER := 0;
BEGIN
IF clear = ‘ 1 ’ THEN
count := 0;
ELSIF load = ‘ 1 ’ THEN
count := data_in;
ELSE
IF (clk’EVENT) AND (clk = ‘ 1 ’) AND
(clk’LAST_VALUE = ‘ 0 ’) THEN
IF (count = 255) THEN
count := 0;
ELSE
count := count + 1;
END IF;