如何解决LUA / URL 查询解析
如何用lua序列化下面的url?
“匹配”可以吗?
http://example.com/go.PHP?user=stack&pass=overflow
域:example.com
用户:堆栈
通过:溢出
解决方法
试试这个:
library IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
---------------Entity--------------
Entity sinx is
PORT (
CLK : in std_logic;
x : in Signed (9 downto 0);
answer : out signed (9 downto 0) );
End sinx;
---------------Architecture Decleration---------
Architecture Behavioral of sinx is
signal fact2 : Signed (19 downto 0) := (Others => '0') ;
signal fact3 : Signed (29 downto 0) := (Others => '0') ;
signal s1 : Signed (59 downto 0) := (Others => '0') ;
signal fact5 : Signed (49 downto 0) := (Others => '0') ;
signal s2 : Signed (99 downto 0) := (Others => '0') ;
signal fact7 : Signed (69 downto 0) := (Others => '0') ;
signal s3 : Signed (139 downto 0) := (Others => '0') ;
signal fact9 : Signed (89 downto 0) := (Others => '0') ;
signal s4 : Signed (179 downto 0) := (Others => '0') ;
-----------------------------Fact 3,5,7,9 Decleration as constants-------------
Constant a : signed(29 downto 0) := "000000000001010101010101010101";
--000000000(9),--(point)001010101010101010101 =>
-- Equal to Decimal (0.1666665)
Constant b : signed(49 downto 0) := "00000000000000000000010001000100010001000100010001";
--000000000000000(15),--(point)00000010001000100010001000100010001
-- Equal to Decimal (0.00833333333)
Constant c : signed(69 downto 0) := "0000000000000000000000000000000001101000000001101000000001101000000001";
--000000000000000000000(21),--(point)0000000000001101000000001101000000001101000000001(49)
-- Equal to Decimal (0.000198412698411)
Constant d : signed(89 downto 0) := "000000000000000000000000000000000000000000000101110001110111100011101001010101011010000000";
--000000000000000000000000000(27),--(point)000000000000000000101110001110111100011101001010101011010000000(63)
-- Equal to Decimal (0.00000275573192239087)
Begin
Process (clk,x)
Begin
If Rising_edge(clk) then
fact2 <= x * x ; -- (x^2) 20 bit
fact3 <= fact2 * x ; -- (x^3) 30 bit
s1 <= fact3 * a ; -- (x^3) * 0.1666 OR (x^3)/6 60 bit
fact5 <= fact3 * fact2 ; -- (x^5) 50 bit
s2 <= fact5 * b ; -- (x^5) * 0.00833 OR (x^5)/120 100 bit
fact7 <= fact5 * fact2 ; -- (x^7) 70 bit
s3 <= fact7 * c ; -- (x^7) * 0.000198 OR (x^7)/5040 140 bit
fact9 <= fact7 * fact2 ; -- (x^9) 90 bit
s4 <= fact9 * d ; -- (x^9)* 0.00000275 OR (x^9)/362880 180 bit
-- Taylor Expansion with 5 Sentences
answer <= x - s1(44 downto 35 ) + s2(72 downto 63 ) - s3(100 downto 91 ) + s4(128 downto 119 );
End if;
End Process;
End Behavioral;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。