






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Filename=âch2.docâ
Example: clock'ACTIVE
Signal Attribute Supported Attribute âactive No âdelayed[(t)] No âevent Yes âlast_active No âlast_event No âlast_value Yes âquiet[(t)] No âstable Yes âtransaction Yes
An activity is any change on the signal value. A change from 1' toX' is an example of an activity, and a change from 1' to1' is an activity. The only criteria is that something happened. However an event requires a change in value of the signal. A change from 1' toX' is an event, but a change from 1' to1' is not an event. All events represent activities, but not all activities represent events.
IF S'STABLE is given without a time expression, the expression defaults to 0 ns which means that the check is for stability of the signal at this exact instance in time. This is equivalent to S'EVENT.
S'EVENT is more efficient than S'STABLE. Simulator will take more work to evaluate S'STABLE.
Example 1:
SIGNAL S: INTEGER; S <= 1 AFTER 1 ns, 2 AFTER 2 ns; The value of S'DELAYED(10ns) will be 1 after 11 ns and 2 after 12 ns.
Example 2: Phase-shifted Clock generation
ENTITY clock IS GENERIC(Cycle_Time: TIME:=25 ns); PORT(Phase0,Phase1:OUT BIT); END clock;
ARCHITECTURE behavior OF clock IS SIGNAL ControlSignal:BIT:='0'; BEGIN ControlSignal <= NOT ControlSignal AFTER Cycle_Time; Phase0 <= ControlSignal; Phase1 <= ControlSignal'DELAYED(Cycle_Time/2); --(Not supported by Autologic II) END behavior;
--Check for Delay Time ASSERT (Delay>=Hold) REPORT âDelay>=Hold Violationâ SEVERITY Warning; END PROCESS; END DFF;
ARCHITECTURE one OF DFF IS SIGNAL value: BIT; BEGIN PROCESS(D,clock) BEGIN IF((NOT clock'LAST_VALUE) AND (clock = `0')) THEN value <= D; END IF; END PROCESS; Q <= TRANSPORT value AFTER Delay; QB <= TRANSPORT NOT value AFTER Delay; END one;
-- Setup Test Bench ENTITY tb IS -- no IO END tb;
ARCHITECTURE setup_one OF tb IS COMPONENT FF GENERIC(Setup,Hold,Delay:TIME); PORT(D,clock: IN BIT;Q,QB:OUT BIT); END COMPONENT; FOR u1:FF USE ENTITY WORK.DFF(one); SIGNAL s1,s2,s3,s4:BIT; BEGIN FF_1: FF GENERIC MAP(2 ns, 1 ns, 5 ns) PORT MAP(s1,s2,s3,s4);
s1 <= 1' AFTER 13 ns;0' AFTER 17 ns; 1' AFTER 27 ns;0' AFTER 35 ns;
s2 <= 1' AFTER 5 ns;0' AFTER 15 ns; 1' AFTER 25 ns;0' AFTER 30 ns; 1' AFTER 35 ns;0' AFTER 40 ns; END setup_one;
Examples: 12343 --base 10 integer literal 2#10011110# --base 2 (binary) integer literal 8#720# --base 8 (octal) integer literal 16#FFFF0ABC# --base 16 (hex) integer literal 16#FFFF_0ABC# --using (_) for readability
Examples:
65_971.333_ 8#43.6#
Example :
SIGNAL output : voltage means that output ranges from 12 to -12.
0','1'); TYPE boolean IS (false,true); TYPE severity_level IS (note,warning,error,failure); TYPE character IS (a','b','c',...);Examples:
TYPE Two_level_logic IS (0','1'); TYPE Three_level_logic IS (0','1','Z'); TYPE Four_level_logic IS (X','0','1','Z'); TYPE Opcode IS (Add,Add_with_carry,Sub,Sub_with_carry,Complement); TYPE qsim_state IS (0','1','X','Z');
min =60 sec; --minute hr =60 min; --hour END UNITS;
Example:
TYPE Resistance IS RANGE 1 TO 10E UNITS ohm; --the base unit. kohm=1000 ohm; --secondary unit, multiple of base unit. END UNITS;
There are two kinds of composite types: arrays and records.
Example:
TYPE Column IS RANGE 1 TO 80; TYPE Row IS RANGE 1 TO 24; TYPE Matrix IS ARRAY (Row,Column) OF boolean;
Array Range: Constrained or unconstrained.
Array Example:
TYPE bit_nibble IS ARRAY(3 DOWNTO 0) OF BIT; TYPE bit_byte IS ARRAY(7 DOWNTO 0) OF BIT; SIGNAL sq4: bit_nibble; SIGNAL sq8: bit_byte;
sq4 <= sq8(2)&sq8(3)&sq8(4)&sq(5); -- reversing sq8 into sq sq8 <= sq(0)&sq8(7 DOWNTO 1) -- rotate right sq8 by 1 sq8 <= sq8(6 DOWNTO 0)&sq8(7) -- rotate left sq8 by 1
Array Initialization:
SIGNAL sq4: bit_nibble :=(`1','0','1','1');
TYPE bit_4by8 IS ARRAY(3 DOWNTO 0, 0 TO 7) OF BIT; SIGNAL sq_4_8: bit_4by8 := ( (0','0','0','0','1','1','1','1'), (0','0','0','1','1','1','1','1') (0','0','1','1','1','1','1','1') (0','1','1','1','1','1','1','1') );
Computer Memory Example:
TYPE memory IS ARRAY(0 TO 11) OF std_logic_vector(0 TO 7); SIGNAL M: memory := ("00000001", "00000010", "11001100", "00000011", "00001001","00000100", "00001010", "00000101", "00001011", "11101110", "00000000", "00000010");
Example:
SIGNAL ray:BIT_VECTOR(0 TO 7);
ray'LEFT - returns 0
ray'RIGHT - returns 7 ray'HIGH - returns 7 ray'LOW - returns 0 ray'RANGE - returns 0 TO 7 ray'REVERSE_RANGE - returns 7 DOWNTO 0 ray'LENGTH - returns 8
RIGHT andHIGH return the same value when the range is declared as "value TO value". In this case the highest index value appears on the right side ofrange declaration. However, if the range is declared as "value DOWNTO value", the highest appears on the left side of the declaration. In this case RIGHT andHIGH would return different values. The same explanation applies to LEFT andLOW.Example:
TYPE array2 IS ARRAY(Integer RANGE <>,Integer RANGE <>) OF Integer; VARIABLE matrix:Array2(1 TO 3, 9 DOWNTO 6) matrix'high(1) -- returns 3 matrix'high(2) -- returns 9 matrix'left(1) -- returns 1 matrix'left(2) -- returns 9
Array Attribute Supported by Autologic II âhigh[(n)] Yes âleft[(n)] Yes âlength[(n)] Yes âlow[(n)] Yes ârange[(n)] Yes âreverse_range[(n)] Yes âright[(n)] Yes
Example:
TYPE Opcode IS (Add,Add_with_carry,Sub,Sub_with_carry,Complement); TYPE Address IS RANGE 16#0000# TO 16#FFFF#; TYPE Instruction IS RECORD Op_field :Opcode; Operand_1 :Address; Operand_2 :Address; END RECORD;