mms.vhd

来自「一个航天航空用的Sparc处理器(配美国欧洲宇航局用的R_tems嵌入式操作系统」· VHDL 代码 · 共 1,831 行 · 第 1/5 页

VHD
1,831
字号
					report "Setup violation on " & PATH & " at time " & ToString(now) &
						". Observed : " & ToString(DeltaT) & ". Setup : " & ToString(SETUP)
					severity warning;
			end if;
			if HOLD > 0 ns and SETUP >= 0 ns and Data'event then
				DeltaT := now - LastEdge;
				assert not(DeltaT <= HOLD)
					report "Hold violation on " & PATH & " at time " & ToString(now) &
						". Observed : " & ToString(DeltaT) & ". Hold : " & ToString(HOLD)
					severity warning;
			end if;
			--------------------
			if SETUP < 0 ns and Data'event then
				DeltaT := now - LastEdge;
				assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
					report "Timing violation on " & PATH & " at time " & ToString(now)
						& ". Observed : " & ToString(DeltaT) & 
						". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
					severity warning;
			end if;	-- nothing if no data event
			--------------------
			if HOLD < 0 ns and EdgeDetect then
				DeltaT := HOLD - DelayedData'last_event;
				assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
					report "Timing violation on " & PATH & " at time " & ToString(now)
						& ". Observed : " & ToString(DeltaT) & 
						". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
					severity warning;
			end if;	-- nothing if no edge detected
			--------------------

			if EdgeDetect then LastEdge := now; end if;
			wait on Ref, Data;
		end loop Infinite;
	end SetupHoldCheck;	-- procedure
	
	--------------------------------------------

	procedure SetupHoldCheck (
		signal Data : std_ulogic_vector;	
		signal Ref : std_ulogic;
		constant EDGE : edge_type := RISING;
		constant SETUP, HOLD : time := 0 ns;
		constant PATH : string := "";
		signal DelayedData : std_ulogic_vector) is
			-- DelayedData must be set to Data'Delayed(abs(HOLD)) 
		
		variable LastEdge : time := 0 ns;
		variable DeltaT : time;
		variable EdgeDetect : boolean;
	begin
		if (not CHECK_ON) or (SETUP = 0 ns and HOLD = 0 ns) then wait; end if;
		if SETUP + HOLD <= 0 ns then
			assert FALSE report "Impossible check on " & PATH &  
				". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
				severity warning;
			wait;
		end if;
		SkipInitProblems : loop
			wait on Ref until (EDGE = RISING and rising_edge(Ref)) or 
												(EDGE = FALLING and falling_edge(Ref));
				-- nothing before first edge of Ref
			LastEdge := now;
			if HOLD >= 0 ns then exit when Data'event or Data'last_event > 0 ns;
			else exit when DelayedData'event or DelayedData'last_event > 0 ns;
			end if;
		end loop SkipInitProblems;

		Infinite : loop
			EdgeDetect := (EDGE = RISING and rising_edge(Ref)) or 
										(EDGE = FALLING and falling_edge(Ref));
			--------------------
			if SETUP > 0 ns and HOLD >= 0 ns and EdgeDetect then
				DeltaT := Data'last_event;
				assert not(DeltaT <= SETUP) 
					report "Setup violation on " & PATH & " at time " & ToString(now) &
						". Observed : " & ToString(DeltaT) & ". Setup : " & ToString(SETUP)
					severity warning;
			end if;
			if HOLD > 0 ns and SETUP >= 0 ns and Data'event then
				DeltaT := now - LastEdge;
				assert not(DeltaT <= HOLD)
					report "Hold violation on " & PATH & " at time " & ToString(now) &
						". Observed : " & ToString(DeltaT) & ". Hold : " & ToString(HOLD)
					severity warning;
			end if;
			--------------------
			if SETUP < 0 ns and Data'event then
				DeltaT := now - LastEdge;
				assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
					report "Timing violation on " & PATH & " at time " & ToString(now)
						& ". Observed : " & ToString(DeltaT) & 
						". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
					severity warning;
			end if;	-- nothing if no data event
			--------------------
			if HOLD < 0 ns and EdgeDetect then
				DeltaT := HOLD - DelayedData'last_event;
				assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
					report "Timing violation on " & PATH & " at time " & ToString(now)
						& ". Observed : " & ToString(DeltaT) & 
						". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
					severity warning;
			end if;	-- nothing if no edge detected
			--------------------
	
			if EdgeDetect then LastEdge := now; end if;
			wait on Ref, Data;
		end loop Infinite;
	end SetupHoldCheck;	-- procedure

	--------------------------------------------

	procedure SetupHoldCheck (
		signal Data : std_logic_vector;	
		signal Ref : std_ulogic;
		constant EDGE : edge_type := RISING;
		constant SETUP, HOLD : time := 0 ns;
		constant PATH : string := "";
		signal DelayedData : std_logic_vector) is
			-- DelayedData must be set to Data'Delayed(abs(HOLD)) 
		
		variable LastEdge : time := 0 ns;
		variable DeltaT : time;
		variable EdgeDetect : boolean;
	begin
		if (not CHECK_ON) or (SETUP = 0 ns and HOLD = 0 ns) then wait; end if;
		if SETUP + HOLD <= 0 ns then
			assert FALSE report "Impossible check on " & PATH &  
				". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
				severity warning;
			wait;
		end if;
		SkipInitProblems : loop
			wait on Ref until (EDGE = RISING and rising_edge(Ref)) or 
												(EDGE = FALLING and falling_edge(Ref));
				-- nothing before first edge of Ref
			LastEdge := now;
			if HOLD >= 0 ns then exit when Data'event or Data'last_event > 0 ns;
			else exit when DelayedData'event or DelayedData'last_event > 0 ns;
			end if;
		end loop SkipInitProblems;

		Infinite : loop
			EdgeDetect := (EDGE = RISING and rising_edge(Ref)) or 
										(EDGE = FALLING and falling_edge(Ref));
			--------------------
			if SETUP > 0 ns and HOLD >= 0 ns and EdgeDetect then
				DeltaT := Data'last_event;
				assert not(DeltaT <= SETUP) 
					report "Setup violation on " & PATH & " at time " & ToString(now) &
						". Observed : " & ToString(DeltaT) & ". Setup : " & ToString(SETUP)
					severity warning;
			end if;
			if HOLD > 0 ns and SETUP >= 0 ns and Data'event then
				DeltaT := now - LastEdge;
				assert not(DeltaT <= HOLD)
					report "Hold violation on " & PATH & " at time " & ToString(now) &
						". Observed : " & ToString(DeltaT) & ". Hold : " & ToString(HOLD)
					severity warning;
			end if;
			--------------------
			if SETUP < 0 ns and Data'event then
				DeltaT := now - LastEdge;
				assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
					report "Timing violation on " & PATH & " at time " & ToString(now)
						& ". Observed : " & ToString(DeltaT) & 
						". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
					severity warning;
			end if;	-- nothing if no data event
			--------------------
			if HOLD < 0 ns and EdgeDetect then
				DeltaT := HOLD - DelayedData'last_event;
				assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
					report "Timing violation on " & PATH & " at time " & ToString(now)
						& ". Observed : " & ToString(DeltaT) & 
						". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
					severity warning;
			end if;	-- nothing if no edge detected
			--------------------
	
			if EdgeDetect then LastEdge := now; end if;
			wait on Ref, Data;
		end loop Infinite;
	end SetupHoldCheck;	-- procedure
	
  -------------------------------------  
  procedure CondSetupHoldCheck ( signal Data   : std_ulogic;	
                                 signal Ref    : std_ulogic;
                                 constant EDGE : edge_type := RISING;
                                 constant SETUP, HOLD : time := 0 ns;
                                 constant PATH : string := "";
                                 signal DelayedData : std_ulogic;
                                 signal EN_CHECKING : boolean) is
    variable LastEdge : time;
    variable DeltaT : time;
    variable EdgeDetect : boolean;
  begin
    if (not CHECK_ON) or (SETUP = 0 ns and HOLD = 0 ns) then wait; end if;
    if SETUP + HOLD <= 0 ns then
       assert FALSE report "Impossible check on " & PATH &  
        ". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
       severity warning;
       wait;
    end if;
    SkipInitProblems : loop
      wait on Ref until (EDGE = RISING and rising_edge(Ref)) or 
                        (EDGE = FALLING and falling_edge(Ref));
         -- nothing before first edge of Ref
      LastEdge := now;
      wait for SETUP;
      if HOLD >= 0 ns then exit when Data'event or Data'last_event > 0 ns;
      else exit when DelayedData'event or DelayedData'last_event > 0 ns;
      end if;
    end loop SkipInitProblems;

    Infinite : loop
      EdgeDetect := (EDGE = RISING and rising_edge(Ref)) or 
                    (EDGE = FALLING and falling_edge(Ref));
                    
      if EN_CHECKING then
        --------------------
        if SETUP > 0 ns and HOLD >= 0 ns and EdgeDetect then
          DeltaT := Data'last_event;
          assert not(DeltaT <= SETUP) 
            report "Setup violation on " & PATH & " at time " & ToString(now) &
             ". Observed : " & ToString(DeltaT) & ". Setup : " & ToString(SETUP)
            severity warning;
        end if;
        if HOLD > 0 ns and SETUP >= 0 ns and Data'event then
          DeltaT := now - LastEdge;
          assert not(DeltaT <= HOLD)
          report "Hold violation on " & PATH & " at time " & ToString(now) &
            ". Observed : " & ToString(DeltaT) & ". Hold : " & ToString(HOLD)
          severity warning;
        end if;
        --------------------
        if SETUP < 0 ns and Data'event then
          DeltaT := now - LastEdge;
          assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
          report "Timing violation on " & PATH & " at time " & ToString(now)
            & ". Observed : " & ToString(DeltaT) & 
              ". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
          severity warning;
        end if;	-- nothing if no data event
        --------------------
        if HOLD < 0 ns and EdgeDetect then
          DeltaT := HOLD - DelayedData'last_event;
          assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
          report "Timing violation on " & PATH & " at time " & ToString(now)
            & ". Observed : " & ToString(DeltaT) & 
              ". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
					severity warning;
        end if;	-- nothing if no edge detected
        --------------------
      end if;

      if EdgeDetect then LastEdge := now; end if;
      wait on Ref, Data;
    end loop Infinite;
  end CondSetupHoldCheck;	-- procedure

  -------------------------------------  
  procedure CondSetupHoldCheck (signal Data   : std_logic_vector;	
                                signal Ref    : std_ulogic;
                                constant EDGE : edge_type := RISING;
                                constant SETUP, HOLD : time := 0 ns;
                                constant PATH : string := "";
                                signal DelayedData : std_logic_vector;
                                signal EN_CHECKING : boolean) is
    variable LastEdge : time;
    variable DeltaT : time;
    variable EdgeDetect : boolean;
  begin
    if (not CHECK_ON) or (SETUP = 0 ns and HOLD = 0 ns) then wait; end if;
    if SETUP + HOLD <= 0 ns then
       assert FALSE report "Impossible check on " & PATH &  
        ". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
       severity warning;
       wait;
    end if;
    SkipInitProblems : loop
      wait on Ref until (EDGE = RISING and rising_edge(Ref)) or 
                        (EDGE = FALLING and falling_edge(Ref));
         -- nothing before first edge of Ref
      LastEdge := now;
      if HOLD >= 0 ns then exit when Data'event or Data'last_event > 0 ns;
      else exit when DelayedData'event or DelayedData'last_event > 0 ns;
      end if;
    end loop SkipInitProblems;

    Infinite : loop
      EdgeDetect := (EDGE = RISING and rising_edge(Ref)) or 
                    (EDGE = FALLING and falling_edge(Ref));
                    
      if EN_CHECKING then
        --------------------
        if SETUP > 0 ns and HOLD >= 0 ns and EdgeDetect then
          DeltaT := Data'last_event;
          assert not(DeltaT <= SETUP) 
            report "Setup violation on " & PATH & " at time " & ToString(now) &
             ". Observed : " & ToString(DeltaT) & ". Setup : " & ToString(SETUP)
            severity warning;
        end if;
        if HOLD > 0 ns and SETUP >= 0 ns and Data'event then
          DeltaT := now - LastEdge;
          assert not(DeltaT <= HOLD)
          report "Hold violation on " & PATH & " at time " & ToString(now) &
            ". Observed : " & ToString(DeltaT) & ". Hold : " & ToString(HOLD)
          severity warning;
        end if;
        --------------------
        if SETUP < 0 ns and Data'event then
          DeltaT := now - LastEdge;
          assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
          report "Timing violation on " & PATH & " at time " & ToString(now)
            & ". Observed : " & ToString(DeltaT) & 
              ". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
          severity warning;
        end if;	-- nothing if no data event
        --------------------
        if HOLD < 0 ns and EdgeDetect then
          DeltaT := HOLD - DelayedData'last_event;
          assert not(-SETUP <= DeltaT and DeltaT <= HOLD)
          report "Timing violation on " & PATH & " at time " & ToString(now)
            & ". Observed : " & ToString(DeltaT) & 
              ". Setup : " & ToString(SETUP) & ". Hold : " & ToString(HOLD)
					severity warning;
        end if;	-- nothing if no edge detected
        --------------------
      end if;

      if EdgeDetect then LastEdge := now; end if;
      wait on Ref, Data;
    end loop Infinite;
  end CondSetupHoldCheck;	-- procedure
  	
	-----------------------------------------------------------
	procedure PulseCheck (
		signal Pin : std_ulogic;
		constant LEVEL : std_ulogic;
		constant WIDTH : time := 0 ns;
		constant SENSE : sense_type := MINIMUM;
		constant PATH : string := "") is
	
		variable PreviousEvent : time := 0 ns;
		variable Detection : boolean := FALSE;
		variable DeltaT : time;
	begin
		if (not CHECK_ON) or WIDTH = 0 ns then wait; end if;
		if WIDTH < 0 ns then
			assert FALSE
				report "Impossible check on " & PATH & ". WIDTH : " & ToString(WIDTH)
				severity warning;
			wait;
		end if;
		wait on Pin;	-- no check before first event on Pin
		loop
			DeltaT := now - PreviousEvent;
			case SENSE is
				when MINIMUM => 
					assert not(Detection and (DeltaT < WIDTH))
						report "Min pulse widt

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?