Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Part 1) PSA support - addressing review comments #618

Merged
merged 14 commits into from
May 15, 2017
Merged

Conversation

hanw
Copy link
Contributor

@hanw hanw commented May 12, 2017

Addressed most of the comments from Mihai.

Need more refactor to get rid of P4V1 namespace. Will do in a later PR.

@hanw hanw requested a review from mihaibudiu May 12, 2017 05:26
Copy link
Contributor

@mihaibudiu mihaibudiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not easy to do a good review when one sees only the diff and all the previous comments are lost. I may have missed important things, but hopefully it won't be too bad.

What happened to the passes that manipulated the checksum? Have you checked that programs that use checksums still work? If you have one of these maybe we can add an STF test for it.

const IR::Key* key,
Util::JsonObject* table,
Util::JsonArray* action_profiles) {
ControlConverter::handleTableImplementation(const IR::Property* implementation,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation still wrong after you renamed the class.

@@ -47,10 +46,10 @@ bool InferArchitecture::preorder(const IR::Type_Control *node) {
return false;
}

/// new Parser_Model object
bool InferArchitecture::preorder(const IR::Type_Parser *node) {
/// new P4::Parser_Model object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this Doxygen comment, it is too short.

@@ -66,19 +65,19 @@ bool InferArchitecture::preorder(const IR::Type_Parser *node) {
/// p4type = p4Type(param);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a strange comment, usually one does not write pseudocode in comments.

for (auto p : node->getConstructorParameters()->parameters) {
LOG1("package constructor param: " << p);
auto ptype = typeMap->getType(p);
if (ptype == nullptr)
continue;
if (ptype->is<IR::P4Parser>()) {
LOG3("new parser model: " << p->toString());
v2model.parsers.push_back(new Parser_Model(p->toString()));
v2model.parsers.push_back(new P4::Parser_Model(p->toString()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is dangerous to rely on the behavior of toString; maybe you can use instead p->name.


class InferArchitecture : public Inspector {
class ExtractArchInfo : public Inspector {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document this class.

@@ -25,31 +25,18 @@ limitations under the License.
namespace BMV2 {

/**
* Copy Annotations from architecture block to the corresponding
* instance in user program.
* Build a map from architecture block to its declaration in uer program.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am hoping that this pass will not be necessary; annotations are a brittle way to do what I think you are doing.
The architecture description language is rich enough to expose all the information you need, you are building another language layer on top of it with annotations, which is not as precise.

@hanw
Copy link
Contributor Author

hanw commented May 12, 2017

I am going to work on the passes that deal with checksums today and add an STF test.

@hanw hanw force-pushed the hanw/psa2 branch 2 times, most recently from 0134c1f to 97c49b6 Compare May 15, 2017 21:12
@hanw hanw merged commit adcb4e6 into p4lang:master May 15, 2017
@hanw hanw deleted the hanw/psa2 branch September 16, 2017 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants