diff --git a/libraries/technology/base/technology_pkg.vhd b/libraries/technology/base/technology_pkg.vhd index d99395239c9dc93b7f963199d32f119a5abd8953..8a8d0299b06c0e1b843bb6451e1843c6e85654bf 100644 --- a/libraries/technology/base/technology_pkg.vhd +++ b/libraries/technology/base/technology_pkg.vhd @@ -40,6 +40,8 @@ PACKAGE technology_pkg IS FUNCTION tech_true_log2(n : NATURAL) RETURN NATURAL; -- tech_true_log2(n) = log2(n) FUNCTION tech_ceil_log2(n : NATURAL) RETURN NATURAL; -- tech_ceil_log2(n) = log2(n), but force tech_ceil_log2(1) = 1 + FUNCTION tech_nat_to_mbps_str( n : IN NATURAL ) RETURN STRING; + END technology_pkg; PACKAGE BODY technology_pkg IS @@ -82,4 +84,19 @@ PACKAGE BODY technology_pkg IS END IF; END; + FUNCTION tech_nat_to_mbps_str( n : IN NATURAL ) RETURN STRING IS -- Converts a selection of naturals to Mbps strings, used for edited MegaWizard file in ip_stratixiv_hssi_*_generic.vhd + VARIABLE r : STRING(1 TO 9); + BEGIN + CASE n is + WHEN 2500 => r := "2500 Mbps"; + WHEN 3125 => r := "3125 Mbps"; + WHEN 5000 => r := "5000 Mbps"; + WHEN 6250 => r := "6250 Mbps"; + WHEN OTHERS => + r := "ERROR: tech_nat_to_mbps_str UNSUPPORTED DATA RATE"; -- This too long string will cause an error in Quartus synthesis + REPORT r SEVERITY FAILURE; -- Severity Failure will stop the Modelsim simulation + END CASE; + RETURN r; + END; + END technology_pkg; \ No newline at end of file