⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 66_signed.vhd

📁 vhdl编程100例,有需要的就下吧
💻 VHD
📖 第 1 页 / 共 5 页
字号:
	       result(i) := not_table(or_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nor";
    ---------------------
    ---------------------
    function "nor" (L: SIGNED; R: UNSIGNED) return UNSIGNED is
	 variable result : UNSIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nor operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(or_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nor";
    ---------------------
    ---------------------
    function "nor" (L: UNSIGNED; R: SIGNED) return SIGNED is
	 variable result : SIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nor operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(or_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nor";
    ---------------------
    ---------------------
    function "nor" (L: UNSIGNED; R: SIGNED) return UNSIGNED is
	 variable result : UNSIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nor operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(or_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nor";
    ---------------------
    ---------------------
    function "nor" (L: UNSIGNED; R: UNSIGNED) return SIGNED is
	 variable result : SIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nor operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(or_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nor";
    ---------------------
    ---------------------
    function "nor" (L: UNSIGNED; R: UNSIGNED) return UNSIGNED is
	 variable result : UNSIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nor operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(or_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nor";
    ---------------------
    ---------------------
    function "nand" (L: SIGNED; R: SIGNED) return SIGNED is
	 variable result : SIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nand operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(and_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nand";
    ---------------------
    ---------------------
    function "nand" (L: SIGNED; R: SIGNED) return UNSIGNED is
	 variable result : UNSIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nand operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(and_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nand";
    ---------------------
    ---------------------
    function "nand" (L: SIGNED; R: UNSIGNED) return SIGNED is
	 variable result : SIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nand operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(and_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nand";
    ---------------------
    ---------------------
    function "nand" (L: SIGNED; R: UNSIGNED) return UNSIGNED is
	 variable result : UNSIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nand operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(and_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nand";
    ---------------------
    ---------------------
    function "nand" (L: UNSIGNED; R: SIGNED) return SIGNED is
	 variable result : SIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nand operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(and_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nand";
    ---------------------
    ---------------------
    function "nand" (L: UNSIGNED; R: SIGNED) return UNSIGNED is
	 variable result : UNSIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nand operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(and_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nand";
    ---------------------
    ---------------------
    function "nand" (L: UNSIGNED; R: UNSIGNED) return SIGNED is
	 variable result : SIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nand operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(and_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nand";
    ---------------------
    ---------------------
    function "nand" (L: UNSIGNED; R: UNSIGNED) return UNSIGNED is
	 variable result : UNSIGNED (L'range);
    begin
	if (L'length /= R'length) then
	     assert false
	     report "arguments of overloaded nand operator have different length"
	     severity error;
        else
	   for i in result'range loop
	       result(i) := not_table(and_table(L(i) , R(i)));
           end loop;
        end if;
	return result;
    end "nand";
    ---------------------
    ---------------------


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

    function max(L, R: INTEGER) return INTEGER is
    begin
	if L > R then
	    return L;
	else
	    return R;
	end if;
    end;


    function min(L, R: INTEGER) return INTEGER is
    begin
	if L < R then
	    return L;
	else
	    return R;
	end if;
    end;

    type tbl_type is array (STD_ULOGIC) of STD_ULOGIC;
    constant tbl_BINARY : tbl_type :=
	('X', 'X', '0', '1', 'X', 'X', '0', '1', 'X');

    type tbl_mvl9_boolean is array (STD_ULOGIC) of boolean;
    constant IS_X : tbl_mvl9_boolean :=
        (true, true, false, false, true, true, false, false, true);



    function MAKE_BINARY(A : STD_ULOGIC) return STD_ULOGIC is
    begin
	    if (IS_X(A)) then
		assert false 
		report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
		severity warning;
	        return ('X');
	    end if;
	    return tbl_BINARY(A);
    end;

    function MAKE_BINARY(A : UNSIGNED) return UNSIGNED is
	variable one_bit : STD_ULOGIC;
	variable result : UNSIGNED (A'range);
    begin
	    for i in A'range loop
	        if (IS_X(A(i))) then
		    assert false 
		    report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
		    severity warning;
		    result := (others => 'X');
	            return result;
	        end if;
		result(i) := tbl_BINARY(A(i));
	    end loop;
	    return result;
    end;

    function MAKE_BINARY(A : UNSIGNED) return SIGNED is
	variable one_bit : STD_ULOGIC;
	variable result : SIGNED (A'range);
    begin
	    for i in A'range loop
	        if (IS_X(A(i))) then
		    assert false 
		    report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
		    severity warning;
		    result := (others => 'X');
	            return result;
	        end if;
		result(i) := tbl_BINARY(A(i));
	    end loop;
	    return result;
    end;

    function MAKE_BINARY(A : SIGNED) return UNSIGNED is
	variable one_bit : STD_ULOGIC;
	variable result : UNSIGNED (A'range);
    begin
	    for i in A'range loop
	        if (IS_X(A(i))) then
		    assert false 
		    report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
		    severity warning;
		    result := (others => 'X');
	            return result;
	        end if;
		result(i) := tbl_BINARY(A(i));
	    end loop;
	    return result;
    end;

    function MAKE_BINARY(A : STD_LOGIC_VECTOR) return UNSIGNED is
    variable result : UNSIGNED (A'range);
    begin
        for i in A'range loop
            if (IS_X(A(i))) then
            assert false
            report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
            severity warning;
            result := (others => 'X');
                return result;
            end if;
        result(i) := tbl_BINARY(A(i));
        end loop;
        return result;
    end;

    function MAKE_BINARY(A : SIGNED) return SIGNED is
	variable one_bit : STD_ULOGIC;
	variable result : SIGNED (A'range);
    begin
	    for i in A'range loop
	        if (IS_X(A(i))) then
		    assert false 
		    report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
		    severity warning;
		    result := (others => 'X');
	            return result;
	        end if;
		result(i) := tbl_BINARY(A(i));
	    end loop;
	    return result;
    end;

    function MAKE_BINARY(A : STD_LOGIC_VECTOR) return SIGNED is
    variable result : SIGNED (A'range);
    begin
        for i in A'range loop
            if (IS_X(A(i))) then
            assert false
            report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
            severity warning;
            result := (others => 'X');
                return result;
            end if;
        result(i) := tbl_BINARY(A(i));
        end loop;
        return result;
    end;

    function MAKE_BINARY(A : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
	variable one_bit : STD_ULOGIC;
	variable result : STD_LOGIC_VECTOR (A'range);
    begin
	    for i in A'range loop
	        if (IS_X(A(i))) then
		    assert false 
		    report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
		    severity warning;
		    result := (others => 'X');
	            return result;
	        end if;
		result(i) := tbl_BINARY(A(i));
	    end loop;
	    return result;
    end;

    function MAKE_BINARY(A : UNSIGNED) return STD_LOGIC_VECTOR is
	variable one_bit : STD_ULOGIC;
	variable result : STD_LOGIC_VECTOR (A'range);
    begin
	    for i in A'range loop
	        if (IS_X(A(i))) then
		    assert false 
		    report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
		    severity warning;
		    result := (others => 'X');
	            return result;
	        end if;
		result(i) := tbl_BINARY(A(i));
	    end loop;
	    return result;
    end;

    function MAKE_BINARY(A : SIGNED) return STD_LOGIC_VECTOR is

⌨️ 快捷键说明

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