MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / compileAnsiPortDeclaration

Method compileAnsiPortDeclaration

src/DesignCompile/CompileHelper.cpp:1895–2094  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1893}
1894
1895bool CompileHelper::compileAnsiPortDeclaration(DesignComponent* component,
1896 const FileContent* fC, NodeId id,
1897 VObjectType& port_direction) {
1898 /*
1899 n<mem_if> u<3> t<StringConst> p<4> l<11>
1900 n<> u<4> t<Data_type> p<5> c<3> l<11>
1901 n<> u<5> t<Data_type_or_implicit> p<6> c<4> l<11>
1902 n<> u<6> t<Net_port_type> p<7> c<5> l<11>
1903 n<> u<7> t<Net_port_header> p<9> c<6> s<8> l<11>
1904 n<sif1> u<8> t<StringConst> p<9> l<11>
1905 n<> u<9> t<Ansi_port_declaration> p<16> c<7> s<15> l<11>
1906
1907 or
1908
1909 n<> u<3> t<PortDir_Inp> p<7> s<6> l<1>
1910 n<> u<4> t<NetType_Wire> p<6> s<5> l<1>
1911 n<> u<5> t<Data_type_or_implicit> p<6> l<1>
1912 n<> u<6> t<Net_port_type> p<7> c<4> l<1>
1913 n<> u<7> t<Net_port_header> p<9> c<3> s<8> l<1>
1914 */
1915
1916 NodeId net_port_header = fC->Child(id);
1917 NodeId identifier = fC->Sibling(net_port_header);
1918 NodeId net_port_type = fC->Child(net_port_header);
1919 VObjectType dir_type = fC->Type(net_port_type);
1920 if (dir_type == VObjectType::paPortDir_Out ||
1921 dir_type == VObjectType::paPortDir_Inp ||
1922 dir_type == VObjectType::paPortDir_Inout ||
1923 dir_type == VObjectType::paPortDir_Ref) {
1924 port_direction = dir_type;
1925 net_port_type = fC->Sibling(net_port_type);
1926 NodeId NetType = fC->Child(net_port_type);
1927 if (fC->Type(NetType) == VObjectType::paData_type_or_implicit) {
1928 NodeId Data_type = fC->Child(NetType);
1929 if (fC->Type(Data_type) == VObjectType::paData_type) {
1930 NetType = fC->Child(Data_type);
1931 }
1932 }
1933
1934 NodeId packedDimension = fC->Sibling(NetType);
1935 if (fC->Type(packedDimension) ==
1936 VObjectType::slStringConst) { // net type is class_scope
1937 packedDimension = fC->Sibling(packedDimension);
1938 }
1939 if (fC->Type(NetType) == VObjectType::paImplicit_data_type) {
1940 packedDimension = fC->Child(NetType);
1941 if (fC->Type(packedDimension) != VObjectType::paPacked_dimension) {
1942 packedDimension = InvalidNodeId;
1943 }
1944 }
1945 NodeId specParamId;
1946 bool is_signed = false;
1947 bool is_var = false;
1948 if (!packedDimension) {
1949 packedDimension = fC->Child(NetType);
1950 }
1951
1952 if (fC->Type(packedDimension) == VObjectType::paSigning_Signed) {

Callers 3

collectObjects_Method · 0.80
collectModuleObjects_Method · 0.80

Calls 15

getSignalTypeFunction · 0.85
setVarMethod · 0.80
setDefaultValueMethod · 0.80
setStaticMethod · 0.80
setTypespecIdMethod · 0.80
getPackedDimensionMethod · 0.80
getTypeSpecIdMethod · 0.80
getUnpackedDimensionMethod · 0.80
ChildMethod · 0.45
SiblingMethod · 0.45
TypeMethod · 0.45
getFileIdMethod · 0.45

Tested by

no test coverage detected