📄 pci_lib.vhd
字号:
commands(CmdNum).addr := Addr; commands(CmdNum).data(count) := Data; commands(CmdNum).data_nr := count_nr; commands(CmdNum).enable(count) := Enable; else report HeaderMsg&"Invalid DATA in WRSW command "; end if; end loop; end if; when "RDSW" => -- read single word command readhex(L,Addr,Good,Enable); if not Good then report HeaderMsg&"Invalid RDSW command in :"&file_name&", line #"& integer'image(LineNum) &", "&"Address parameter should be 8 hex characters" severity MsgSeverity; ErrFlag := true; else Good := true; readhex(L,Data_byte,Good,Enable); count_nr :=Byte2Int(Data_Byte); count := 0; for I in 0 to count_nr-1 loop readhex(L,Data,Good,Enable); if (Good =true) then count := count + 1; commands(CmdNum).command := "RDSW"; commands(CmdNum).addr := Addr; commands(CmdNum).data(count) := Data; commands(CmdNum).data_nr := count_nr; commands(CmdNum).enable(count) := Enable; else report HeaderMsg&"Invalid DATA in RDSW command "; end if; end loop; end if; when "WRMW" => -- write multiple words command readhex(L,Addr,Good,Enable); if not Good then report HeaderMsg&"Invalid WRMW command in :"&file_name&", line #"& integer'image(LineNum) &", "&"Address parameter should be 8 hex characters" severity MsgSeverity; ErrFlag := true; else Good := true; readhex(L,Data_byte,Good,Enable); count_nr :=Byte2Int(Data_Byte); count := 0; for I in 0 to count_nr-1 loop readhex(L,Data,Good,Enable); if (Good =true) then count := count + 1; commands(CmdNum).command := "WRMW"; commands(CmdNum).addr := Addr; commands(CmdNum).data(count) := Data; commands(CmdNum).data_nr := count_nr; commands(CmdNum).enable(count) := Enable; else report HeaderMsg&"Invalid DATA in WRMW command "; end if; end loop; end if; when "RDMW" => -- read multiple words command readhex(L,Addr,Good,Enable); if not Good then report HeaderMsg&"Invalid RDMW command in :"&file_name&", line #"& integer'image(LineNum) &", "&"Address parameter should be 8 hex characters" severity MsgSeverity; ErrFlag := true; else Good := true; readhex(L,Data_Byte,Good,Enable); count_nr :=Byte2Int(Data_Byte); count := 0; for I in 0 to count_nr-1 loop readhex(L,Data,Good,Enable); if (Good =true) then count := count + 1; commands(CmdNum).command := "RDMW"; commands(CmdNum).addr := Addr; commands(CmdNum).data(count) := Data; commands(CmdNum).data_nr := count_nr; commands(CmdNum).enable(count) := Enable; else report HeaderMsg&"Invalid DATA in RDMW command "; end if; end loop; end if; when "RDML" => -- read multiple words command readhex(L,Addr,Good,Enable); if not Good then report HeaderMsg&"Invalid RDML command in :"&file_name&", line #"& integer'image(LineNum) &", "&"Address parameter should be 8 hex characters" severity MsgSeverity; ErrFlag := true; else Good := true; readhex(L,Data_Byte,Good,Enable); count_nr :=Byte2Int(Data_Byte); count := 0; for I in 0 to count_nr-1 loop readhex(L,Data,Good,Enable); if (Good =true) then count := count + 1; commands(CmdNum).command := "RDML"; commands(CmdNum).addr := Addr; commands(CmdNum).data(count) := Data; commands(CmdNum).data_nr := count_nr; commands(CmdNum).enable(count) := Enable; else report HeaderMsg&"Invalid DATA in RDML command "; end if; end loop; end if; when "WCFG" => -- write to configuration space command readhex(L,Addr,Good,Enable); if not Good then report HeaderMsg&"Invalid WCFG command in :"&file_name&", line #"& integer'image(LineNum) &", "&"Address parameter should be 8 hex characters" severity MsgSeverity; ErrFlag := true; else Good := true; readhex(L,Data_byte,Good,Enable); count_nr :=Byte2Int(Data_Byte); count := 0; for I in 0 to count_nr-1 loop readhex(L,Data,Good,Enable); if (Good =true) then count := count + 1; commands(CmdNum).command := "WCFG"; commands(CmdNum).addr := Addr; commands(CmdNum).data(count) := Data; commands(CmdNum).data_nr := count_nr; commands(CmdNum).enable(count) := Enable; else report HeaderMsg&"Invalid DATA in WCFG command "; end if; end loop; end if; when "RCFG" => -- read from configuration space command readhex(L,Addr,Good,Enable); if not Good then report HeaderMsg&"Invalid RCFG command in :"&file_name&", line #"& integer'image(LineNum) &", "&"Address parameter should be 8 hex characters" severity MsgSeverity; ErrFlag := true; else Good := true; readhex(L,Data_Byte,Good,Enable); count_nr :=Byte2Int(Data_Byte); count := 0; for I in 0 to count_nr-1 loop readhex(L,Data,Good,Enable); if (Good =true) then count := count + 1; commands(CmdNum).command := "RCFG"; commands(CmdNum).addr := Addr; commands(CmdNum).data(count) := Data; commands(CmdNum).data_nr := count_nr; commands(CmdNum).enable(count) := Enable; else report HeaderMsg&"Invalid DATA in RCFG command "; end if; end loop; end if; when "WRIO" => -- write to I/O space command readhex(L,Addr,Good,Enable); if not Good then report HeaderMsg&"Invalid WRIO command in :"&file_name&", line #"& integer'image(LineNum) &", "&"Address parameter should be 8 hex characters" severity MsgSeverity; ErrFlag := true; else Good := true; readhex(L,Data_byte,Good,Enable); count_nr :=Byte2Int(Data_Byte); count := 0; for I in 0 to count_nr-1 loop readhex(L,Data,Good,Enable); if (Good = true) then count := count + 1; commands(CmdNum).command := "WRIO"; commands(CmdNum).addr := Addr; commands(CmdNum).data(count) := Data; commands(CmdNum).data_nr := count_nr; commands(CmdNum).enable(count) := Enable; else report HeaderMsg&"Invalid DATA in WRIO command "; end if; end loop; end if; when "RDIO" => -- read from I/O space command readhex(L,Addr,Good,Enable); if not Good then report HeaderMsg&"Invalid RDIO command in :"&file_name&", line #"& integer'image(LineNum) &", "&"Address parameter should be 8 hex characters" severity MsgSeverity; ErrFlag := true; else Good := true; readhex(L,Data_Byte,Good,Enable); count_nr :=Byte2Int(Data_Byte); count := 0; for I in 0 to count_nr-1 loop readhex(L,Data,Good,Enable); if (Good = true) then count := count + 1; commands(CmdNum).command := "RDIO"; commands(CmdNum).addr := Addr; commands(CmdNum).data(count) := Data; commands(CmdNum).data_nr := count_nr; commands(CmdNum).enable(count) := Enable; else report HeaderMsg&"Invalid DATA in RDIO command "; end if; end loop; end if; when "CWAT" => readhex(L,Addr,Good,Enable); if not Good then report HeaderMsg&"Invalid CWAT command in :"&file_name&", line #"& integer'image(LineNum) &", "&"Address parameter should be 8 hex characters" severity MsgSeverity; ErrFlag := true; else count_nr :=0; readhex(L,Data,Good,Enable); if (Good = true) then count :=count +1; commands(CmdNum).command := "WAIT"; commands(CmdNum).addr := Addr; commands(CmdNum).data(1) := Data; commands(CmdNum).data_nr := 1; commands(CmdNum).enable(1) := Enable; else report HeaderMsg&"Invalid DATA in CWAT command "; end if; end if; when "ABRT" => count :=count + 1; commands(CmdNum).command := "ABRT"; commands(CmdNum).addr := "00000000000000000000000000000000"; commands(CmdNum).data(1) := "00000000000000000000000000000000"; commands(CmdNum).data_nr := 1; commands(CmdNum).enable(1) := Enable; when others => CmdNum := CmdNum -1; if str4(1 to 2)/= "##" then report HeaderMsg & "Invalid command in file: "&file_name&", line #"& integer'image(LineNum) &", "& "Unknown command : "& str4 & l(l'left to l'right) severity error; ErrFlag := true; end if; end case; end if; NumCommands := CmdNum; Exit when EndOfFile; end loop; end FileParser; -------------------------------------------------------------------- --------------------------------------------------------------------end PCI_Def; --================ End of package body ================--
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -