-
Notifications
You must be signed in to change notification settings - Fork 30
floonoc: bug fixes and add support for multiple address rules on the same target #56
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
base: master
Are you sure you want to change the base?
Changes from all commits
2442ace
c3b69c8
b31a057
94cf78b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -71,16 +71,16 @@ void NetworkQueue::handle_req(vp::IoReq *req) | |||||||||||||||||||||||||
| this->trace.msg(vp::Trace::LEVEL_DEBUG, "Received %s burst from initiator (burst: %p, offset: 0x%x, size: 0x%x, is_write: %d, op: %d)\n", | ||||||||||||||||||||||||||
| req->get_int(FlooNoc::REQ_WIDE) ? "wide" : "narrow", req, req->get_addr(), req->get_size(), req->get_is_write(), req->get_opcode()); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| this->enqueue_router_req(req, true); | ||||||||||||||||||||||||||
| this->enqueue_router_req(req, true, true); | ||||||||||||||||||||||||||
| if (req->get_is_write()) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| this->enqueue_router_req(req, false); | ||||||||||||||||||||||||||
| this->enqueue_router_req(req, false, true); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| void NetworkQueue::handle_rsp(vp::IoReq *req, bool is_address) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| this->enqueue_router_req(req, is_address); | ||||||||||||||||||||||||||
| this->enqueue_router_req(req, is_address, false); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| bool NetworkQueue::handle_request(FloonocNode *node, vp::IoReq *req, int from_x, int from_y) | ||||||||||||||||||||||||||
|
|
@@ -89,12 +89,11 @@ bool NetworkQueue::handle_request(FloonocNode *node, vp::IoReq *req, int from_x, | |||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| void NetworkQueue::enqueue_router_req(vp::IoReq *req, bool is_address) | ||||||||||||||||||||||||||
| void NetworkQueue::enqueue_router_req(vp::IoReq *req, bool is_address, bool is_req) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| uint64_t burst_base = req->get_addr(); | ||||||||||||||||||||||||||
| uint64_t burst_size = req->get_size(); | ||||||||||||||||||||||||||
| uint8_t *burst_data = req->get_data(); | ||||||||||||||||||||||||||
| bool wide = *(bool *)req->arg_get(FlooNoc::REQ_WIDE); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| while(burst_size > 0) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
|
|
@@ -107,16 +106,17 @@ void NetworkQueue::enqueue_router_req(vp::IoReq *req, bool is_address) | |||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_SRC_NI) = (void *)&this->ni; | ||||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_BURST) = (void *)req; | ||||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_IS_ADDRESS) = (void *)is_address; | ||||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_WIDE) = (void *)wide; | ||||||||||||||||||||||||||
| router_req->set_size(size); | ||||||||||||||||||||||||||
| router_req->set_data(burst_data); | ||||||||||||||||||||||||||
| router_req->set_addr(burst_base); | ||||||||||||||||||||||||||
| router_req->set_is_write(req->get_is_write()); | ||||||||||||||||||||||||||
| router_req->set_opcode(req->get_opcode()); | ||||||||||||||||||||||||||
| router_req->set_second_data(req->get_second_data()); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if (*(NetworkInterface **)req->arg_get(FlooNoc::REQ_SRC_NI)) | ||||||||||||||||||||||||||
| if (is_req) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| bool wide = *(bool *)req->arg_get(IO_REQ_NB_ARGS-1); | ||||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_WIDE) = (void *)wide; | ||||||||||||||||||||||||||
| if (wide) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| req->get_is_write() ? this->ni.wide_write_pending_burst_nb_req++ : | ||||||||||||||||||||||||||
|
|
@@ -164,6 +164,7 @@ void NetworkQueue::enqueue_router_req(vp::IoReq *req, bool is_address) | |||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_SRC_NI) = NULL; | ||||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_WIDE) = *req->arg_get(FlooNoc::REQ_WIDE); | ||||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_DEST_X) = *req->arg_get(FlooNoc::REQ_DEST_X); | ||||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_DEST_Y) = *req->arg_get(FlooNoc::REQ_DEST_Y); | ||||||||||||||||||||||||||
| *router_req->arg_get(FlooNoc::REQ_BURST) = *req->arg_get(FlooNoc::REQ_BURST); | ||||||||||||||||||||||||||
|
|
@@ -360,15 +361,15 @@ vp::IoReqStatus NetworkInterface::narrow_req(vp::Block *__this, vp::IoReq *req) | |||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| NetworkInterface *_this = (NetworkInterface *)__this; | ||||||||||||||||||||||||||
| _this->signal_narrow_req = req->get_addr(); | ||||||||||||||||||||||||||
| *req->arg_get(FlooNoc::REQ_WIDE) = (void *)0; | ||||||||||||||||||||||||||
| *(bool *)req->arg_get(IO_REQ_NB_ARGS-1) = false; | ||||||||||||||||||||||||||
| return _this->handle_req(req); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| vp::IoReqStatus NetworkInterface::wide_req(vp::Block *__this, vp::IoReq *req) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| NetworkInterface *_this = (NetworkInterface *)__this; | ||||||||||||||||||||||||||
| _this->signal_wide_req = req->get_addr(); | ||||||||||||||||||||||||||
| *req->arg_get(FlooNoc::REQ_WIDE) = (void *)1; | ||||||||||||||||||||||||||
| *(bool *)req->arg_get(IO_REQ_NB_ARGS-1) = true; | ||||||||||||||||||||||||||
| return _this->handle_req(req); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -383,7 +384,7 @@ vp::IoReqStatus NetworkInterface::handle_req(vp::IoReq *req) | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| vp::IoReq **queue; | ||||||||||||||||||||||||||
| std::queue<vp::IoReq *> *denied_queue; | ||||||||||||||||||||||||||
| bool is_wide = *(bool *)req->arg_get(FlooNoc::REQ_WIDE); | ||||||||||||||||||||||||||
| bool is_wide = *(bool *)req->arg_get(IO_REQ_NB_ARGS-1); | ||||||||||||||||||||||||||
| if (is_wide) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| queue = req->get_is_write() ? &this->wide_write_pending_burst : | ||||||||||||||||||||||||||
|
|
@@ -408,7 +409,7 @@ vp::IoReqStatus NetworkInterface::handle_req(vp::IoReq *req) | |||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| this->nb_pending_bursts[is_wide]++; | ||||||||||||||||||||||||||
| *queue = req; | ||||||||||||||||||||||||||
| if (!req->get_is_write() || !*(vp::IoReq **)req->arg_get(FlooNoc::REQ_WIDE)) | ||||||||||||||||||||||||||
| if (!req->get_is_write() || !is_wide) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| this->req_queue.handle_req(req); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
@@ -488,14 +489,13 @@ bool NetworkInterface::handle_request(FloonocNode *node, vp::IoReq *req, int fro | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if (result == vp::IO_REQ_OK) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| NetworkInterface *ni = *(NetworkInterface **)req->arg_get(FlooNoc::REQ_SRC_NI); | ||||||||||||||||||||||||||
| if (req->get_latency() > 0) | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| this->response_queue.push_delayed(req, req->get_latency()); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| ni->handle_response(req); | ||||||||||||||||||||||||||
| this->handle_response(req); | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| this->handle_response(req); | |
| // Retrieve the source NI from the request and send the response back to it | |
| NetworkInterface *source_ni = (NetworkInterface *)req->arg_get(FlooNoc::REQ_SOURCE_NI); | |
| if (source_ni != nullptr) | |
| { | |
| source_ni->handle_response(req); | |
| } | |
| else | |
| { | |
| // Fallback: handle locally if source NI is not set | |
| this->handle_response(req); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number
IO_REQ_NB_ARGS-1is used multiple times throughout the file for accessing the wide flag. Consider defining a named constant likeFlooNoc::REQ_WIDE_FLAGto improve code clarity and maintainability.