📄 fixed_pkg_c.vhdl
字号:
-- string and textio Functions --=========================================================================== -- purpose: writes fixed point into a line procedure WRITE ( L : inout LINE; -- input line VALUE : in UNRESOLVED_ufixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); -- purpose: writes fixed point into a line procedure WRITE ( L : inout LINE; -- input line VALUE : in UNRESOLVED_sfixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); procedure READ(L : inout LINE; VALUE : out UNRESOLVED_ufixed); procedure READ(L : inout LINE; VALUE : out UNRESOLVED_ufixed; GOOD : out BOOLEAN); procedure READ(L : inout LINE; VALUE : out UNRESOLVED_sfixed); procedure READ(L : inout LINE; VALUE : out UNRESOLVED_sfixed; GOOD : out BOOLEAN); alias bwrite is WRITE [LINE, UNRESOLVED_ufixed, SIDE, width]; alias bwrite is WRITE [LINE, UNRESOLVED_sfixed, SIDE, width]; alias bread is READ [LINE, UNRESOLVED_ufixed]; alias bread is READ [LINE, UNRESOLVED_ufixed, BOOLEAN]; alias bread is READ [LINE, UNRESOLVED_sfixed]; alias bread is READ [LINE, UNRESOLVED_sfixed, BOOLEAN]; alias BINARY_WRITE is WRITE [LINE, UNRESOLVED_ufixed, SIDE, width]; alias BINARY_WRITE is WRITE [LINE, UNRESOLVED_sfixed, SIDE, width]; alias BINARY_READ is READ [LINE, UNRESOLVED_ufixed, BOOLEAN]; alias BINARY_READ is READ [LINE, UNRESOLVED_ufixed]; alias BINARY_READ is READ [LINE, UNRESOLVED_sfixed, BOOLEAN]; alias BINARY_READ is READ [LINE, UNRESOLVED_sfixed]; -- octal read and write procedure OWRITE ( L : inout LINE; -- input line VALUE : in UNRESOLVED_ufixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); procedure OWRITE ( L : inout LINE; -- input line VALUE : in UNRESOLVED_sfixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); procedure OREAD(L : inout LINE; VALUE : out UNRESOLVED_ufixed); procedure OREAD(L : inout LINE; VALUE : out UNRESOLVED_ufixed; GOOD : out BOOLEAN); procedure OREAD(L : inout LINE; VALUE : out UNRESOLVED_sfixed); procedure OREAD(L : inout LINE; VALUE : out UNRESOLVED_sfixed; GOOD : out BOOLEAN); alias OCTAL_READ is OREAD [LINE, UNRESOLVED_ufixed, BOOLEAN]; alias OCTAL_READ is OREAD [LINE, UNRESOLVED_ufixed]; alias OCTAL_READ is OREAD [LINE, UNRESOLVED_sfixed, BOOLEAN]; alias OCTAL_READ is OREAD [LINE, UNRESOLVED_sfixed]; alias OCTAL_WRITE is OWRITE [LINE, UNRESOLVED_ufixed, SIDE, WIDTH]; alias OCTAL_WRITE is OWRITE [LINE, UNRESOLVED_sfixed, SIDE, WIDTH]; -- hex read and write procedure HWRITE ( L : inout LINE; -- input line VALUE : in UNRESOLVED_ufixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); -- purpose: writes fixed point into a line procedure HWRITE ( L : inout LINE; -- input line VALUE : in UNRESOLVED_sfixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); procedure HREAD(L : inout LINE; VALUE : out UNRESOLVED_ufixed); procedure HREAD(L : inout LINE; VALUE : out UNRESOLVED_ufixed; GOOD : out BOOLEAN); procedure HREAD(L : inout LINE; VALUE : out UNRESOLVED_sfixed); procedure HREAD(L : inout LINE; VALUE : out UNRESOLVED_sfixed; GOOD : out BOOLEAN); alias HEX_READ is HREAD [LINE, UNRESOLVED_ufixed, BOOLEAN]; alias HEX_READ is HREAD [LINE, UNRESOLVED_sfixed, BOOLEAN]; alias HEX_READ is HREAD [LINE, UNRESOLVED_ufixed]; alias HEX_READ is HREAD [LINE, UNRESOLVED_sfixed]; alias HEX_WRITE is HWRITE [LINE, UNRESOLVED_ufixed, SIDE, WIDTH]; alias HEX_WRITE is HWRITE [LINE, UNRESOLVED_sfixed, SIDE, WIDTH]; -- returns a string, useful for: -- assert (x = y) report "error found " & to_string(x) severity error; function to_string (value : UNRESOLVED_ufixed) return STRING; alias to_bstring is to_string [UNRESOLVED_ufixed return STRING]; alias TO_BINARY_STRING is TO_STRING [UNRESOLVED_ufixed return STRING]; function to_ostring (value : UNRESOLVED_ufixed) return STRING; alias TO_OCTAL_STRING is TO_OSTRING [UNRESOLVED_ufixed return STRING]; function to_hstring (value : UNRESOLVED_ufixed) return STRING; alias TO_HEX_STRING is TO_HSTRING [UNRESOLVED_ufixed return STRING]; function to_string (value : UNRESOLVED_sfixed) return STRING; alias to_bstring is to_string [UNRESOLVED_sfixed return STRING]; alias TO_BINARY_STRING is TO_STRING [UNRESOLVED_sfixed return STRING]; function to_ostring (value : UNRESOLVED_sfixed) return STRING; alias TO_OCTAL_STRING is TO_OSTRING [UNRESOLVED_sfixed return STRING]; function to_hstring (value : UNRESOLVED_sfixed) return STRING; alias TO_HEX_STRING is TO_HSTRING [UNRESOLVED_sfixed return STRING]; -- From string functions allow you to convert a string into a fixed -- point number. Example: -- signal uf1 : ufixed (3 downto -3); -- uf1 <= from_string ("0110.100", uf1'high, uf1'low); -- 6.5 -- The "." is optional in this syntax, however it exist and is -- in the wrong location an error is produced. Overflow will -- result in saturation. function from_string ( bstring : STRING; -- binary string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_ufixed; alias from_bstring is from_string [STRING, INTEGER, INTEGER return UNRESOLVED_ufixed]; alias from_binary_string is from_string [STRING, INTEGER, INTEGER return UNRESOLVED_ufixed]; -- Octal and hex conversions work as follows: -- uf1 <= from_hstring ("6.8", 3, -3); -- 6.5 (bottom zeros dropped) -- uf1 <= from_ostring ("06.4", 3, -3); -- 6.5 (top zeros dropped) function from_ostring ( ostring : STRING; -- Octal string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_ufixed; alias from_octal_string is from_ostring [STRING, INTEGER, INTEGER return UNRESOLVED_ufixed]; function from_hstring ( hstring : STRING; -- hex string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_ufixed; alias from_hex_string is from_hstring [STRING, INTEGER, INTEGER return UNRESOLVED_ufixed]; function from_string ( bstring : STRING; -- binary string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_sfixed; alias from_bstring is from_string [STRING, INTEGER, INTEGER return UNRESOLVED_sfixed]; alias from_binary_string is from_string [STRING, INTEGER, INTEGER return UNRESOLVED_sfixed]; function from_ostring ( ostring : STRING; -- Octal string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_sfixed; alias from_octal_string is from_ostring [STRING, INTEGER, INTEGER return UNRESOLVED_sfixed]; function from_hstring ( hstring : STRING; -- hex string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_sfixed; alias from_hex_string is from_hstring [STRING, INTEGER, INTEGER return UNRESOLVED_sfixed]; -- Same as above, "size_res" is used for it's range only. function from_string ( bstring : STRING; -- binary string size_res : UNRESOLVED_ufixed) return UNRESOLVED_ufixed; alias from_bstring is from_string [STRING, UNRESOLVED_ufixed return UNRESOLVED_ufixed]; alias from_binary_string is from_string [STRING, UNRESOLVED_ufixed return UNRESOLVED_ufixed]; function from_ostring ( ostring : STRING; -- Octal string size_res : UNRESOLVED_ufixed) return UNRESOLVED_ufixed; alias from_octal_string is from_ostring [STRING, UNRESOLVED_ufixed return UNRESOLVED_ufixed]; function from_hstring ( hstring : STRING; -- hex string size_res : UNRESOLVED_ufixed) return UNRESOLVED_ufixed; alias from_hex_string is from_hstring [STRING, UNRESOLVED_ufixed return UNRESOLVED_ufixed]; function from_string ( bstring : STRING; -- binary string size_res : UNRESOLVED_sfixed) return UNRESOLVED_sfixed; alias from_bstring is from_string [STRING, UNRESOLVED_sfixed return UNRESOLVED_sfixed]; alias from_binary_string is from_string [STRING, UNRESOLVED_sfixed return UNRESOLVED_sfixed]; function from_ostring ( ostring : STRING; -- Octal string size_res : UNRESOLVED_sfixed) return UNRESOLVED_sfixed; alias from_octal_string is from_ostring [STRING, UNRESOLVED_sfixed return UNRESOLVED_sfixed]; function from_hstring ( hstring : STRING; -- hex string size_res : UNRESOLVED_sfixed) return UNRESOLVED_sfixed; alias from_hex_string is from_hstring [STRING, UNRESOLVED_sfixed return UNRESOLVED_sfixed]; -- Direct conversion functions. Example: -- signal uf1 : ufixed (3 downto -3); -- uf1 <= from_string ("0110.100"); -- 6.5 -- In this case the "." is not optional, and the size of -- the output must match exactly. function from_string ( bstring : STRING) -- binary string return UNRESOLVED_ufixed; alias from_bstring is from_string [STRING return UNRESOLVED_ufixed]; alias from_binary_string is from_string [STRING return UNRESOLVED_ufixed]; -- Direct octal and hex conversion functions. In this case -- the string lengths must match. Example: -- signal sf1 := sfixed (5 downto -3); -- sf1 <= from_ostring ("71.4") -- -6.5 function from_ostring ( ostring : STRING) -- Octal string return UNRESOLVED_ufixed; alias from_octal_string is from_ostring [STRING return UNRESOLVED_ufixed]; function from_hstring ( hstring : STRING) -- hex string return UNRESOLVED_ufixed; alias from_hex_string is from_hstring [STRING return UNRESOLVED_ufixed]; function from_string ( bstring : STRING) -- binary string return UNRESOLVED_sfixed; alias from_bstring is from_string [STRING return UNRESOLVED_sfixed]; alias from_binary_string is from_string [STRING return UNRESOLVED_sfixed]; function from_ostring ( ostring : STRING)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -