-
Notifications
You must be signed in to change notification settings - Fork 13
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
Initial commit for ctrl&data preloading. #69
Conversation
I'm confused about how to transmit preload data through NoC. |
Another issue is that CtrlPktType of |
Replied here: #68 (comment) |
We just need to send data pkt into NoC regardless the pkt's dst (via the VectorCGRA/controller/ControllerRTL.py Line 230 in 7222dae
Each controller would only receive the pkt belonging to its self, i.e., controller 2 would never receive pkt belonging to controller 1/3. |
controller/ControllerRTL.py
Outdated
@update | ||
def update_send_to_ctrl_ring_msg(): | ||
# Delivers the ctrl pkt that belongs to current controller to the CGRA tiles. | ||
if s.recv_ctrl_pkt_queue.send.msg.dst == controller_id: | ||
if s.send_to_ctrl_ring_ctrl_pkt.rdy: | ||
s.send_to_ctrl_ring_ctrl_pkt.val @= 1 | ||
s.send_to_ctrl_ring_ctrl_pkt.msg @= s.recv_ctrl_pkt_queue.send.msg | ||
else: | ||
s.send_to_ctrl_ring_ctrl_pkt.val @= 0 | ||
s.send_to_ctrl_ring_ctrl_pkt.msg @= CtrlPktType() | ||
|
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.
You already send config into NoC. Then the handler should be implemented on line 275.
lib/cmd_type.py
Outdated
@@ -19,6 +19,8 @@ | |||
CMD_LOAD_REQUEST = 4 | |||
CMD_LOAD_RESPONSE = 5 | |||
CMD_STORE_REQUEST = 6 | |||
CMD_PRELOAD_CTRL = 7 |
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.
CMD_CONFIG
if for this purpose.
lib/cmd_type.py
Outdated
@@ -19,6 +19,8 @@ | |||
CMD_LOAD_REQUEST = 4 | |||
CMD_LOAD_RESPONSE = 5 | |||
CMD_STORE_REQUEST = 6 | |||
CMD_PRELOAD_CTRL = 7 | |||
CMD_PRELOAD_DATA = 8 |
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.
CMD_STORE_REQUEST
can be leveraged for this purpose.
controller/ControllerRTL.py
Outdated
if controller_id == 0: | ||
# Preloads ctrl to the 1st controller. | ||
if s.recv_ctrl_pkt_queue.recv.rdy: | ||
s.recv_ctrl_pkt_queue.recv.val @= s.recv_from_cpu_ctrl_pkt.val | ||
s.recv_ctrl_pkt_queue.recv.msg @= s.recv_from_cpu_ctrl_pkt.msg | ||
# Preloads data to the 1st controller. | ||
if s.send_to_tile_store_request_addr_queue.recv.rdy & \ | ||
s.send_to_tile_store_request_data_queue.recv.rdy: | ||
s.recv_from_cpu_ctrl_pkt.rdy @= 1 | ||
# TODO: Renames recv_from_cpu_ctrl_pkt to recv_from_cpu_pkt, add cmd, data, and addr field for preloading. | ||
#s.send_to_tile_store_request_addr_queue.recv.msg @= \ | ||
# CGRAAddrType(s.recv_from_cpu_ctrl_pkt.msg.addr) | ||
#s.send_to_tile_store_request_data_queue.recv.msg @= \ | ||
# CGRADataType(s.recv_from_cpu_ctrl_pkt.msg.data, s.recv_from_cpu_ctrl_pkt.msg.predicate, 0, 0) | ||
s.send_to_tile_store_request_addr_queue.recv.msg @= CGRAAddrType() | ||
s.send_to_tile_store_request_data_queue.recv.msg @= CGRADataType() | ||
s.send_to_tile_store_request_addr_queue.recv.val @= s.recv_from_cpu_ctrl_pkt.val | ||
s.send_to_tile_store_request_data_queue.recv.val @= s.recv_from_cpu_ctrl_pkt.val | ||
|
||
else: | ||
# Preloads ctrl to the rest of controllers through NoC. | ||
if s.recv_from_noc.msg.cmd == CMD_PRELOAD_CTRL: | ||
if s.recv_ctrl_pkt_queue.recv.rdy: | ||
s.recv_ctrl_pkt_queue.recv.val @= s.recv_from_noc.val | ||
# TODO: CtrlPktType of recv_ctrl_pkt_queue is incompatible with NocPktType of recv_from_noc. | ||
#s.recv_ctrl_pkt_queue.recv.msg @= CtrlPktType(received_pkt.src, | ||
# received_pkt.dst, | ||
# received_pkt.opaque, | ||
# received_pkt.cmd, | ||
# received_pkt.addr, | ||
# received_pkt.data, | ||
# received_pkt.predicate) | ||
# Preloads data to the rest of controllers through NoC. | ||
elif s.recv_from_noc.msg.cmd == CMD_PRELOAD_DATA: | ||
if s.send_to_tile_store_request_addr_queue.recv.rdy & \ | ||
s.send_to_tile_store_request_data_queue.recv.rdy: | ||
s.recv_from_noc.rdy @= 1 | ||
s.send_to_tile_store_request_addr_queue.recv.msg @= \ | ||
CGRAAddrType(received_pkt.addr) | ||
s.send_to_tile_store_request_data_queue.recv.msg @= \ | ||
CGRADataType(received_pkt.data, received_pkt.predicate, 0, 0) | ||
s.send_to_tile_store_request_addr_queue.recv.val @= s.recv_from_noc.val | ||
s.send_to_tile_store_request_data_queue.recv.val @= s.recv_from_noc.val |
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.
I believe line 256 already handled these.
controller/ControllerRTL.py
Outdated
0, # dst_y | ||
0, | ||
0, | ||
CMD_PRELOAD_CTRL, |
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.
Change this to CMD_CONFIG
.
controller/ControllerRTL.py
Outdated
0) | ||
|
||
# For the data preloading. | ||
# TODO: Where deos the preloading data for other controllers come from, recv_from_noc or recv_from_tile_store_request_pkt? |
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.
I think the most simple/straightforward way is:
s.crossbar.recv[kStoreRequestFromCpuInportIdx].val @= \
s.recv_ctrl_pkt_queue.send.val & (s.recv_ctrl_pkt_queue.send.msg.cmd_action == CMD_STORE_REQUEST)
s.recv_ctrl_pkt_queue.send.rdy @= s.crossbar.recv[kStoreRequestFromCpuInportIdx].rdy
controller/ControllerRTL.py
Outdated
s.crossbar.recv[kPreloadCtrlIdx].val @= \ | ||
s.recv_ctrl_pkt_queue.send.val | ||
s.recv_ctrl_pkt_queue.send.rdy @= s.crossbar.recv[kPreloadCtrlIdx].rdy | ||
s.crossbar.recv[kPreloadCtrlIdx].msg @= \ | ||
NocPktType(controller_id, |
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.
I think this should depend on cpu msg type:
s.crossbar.recv[kPreloadCtrlIdx].val @= s.recv_ctrl_pkt_queue.send.val & (s.recv_ctrl_pkt_queue.send.msg.cmd_action == CMD_CONFIG)
s.recv_ctrl_pkt_queue.send.rdy @= s.crossbar.recv[kPreloadCtrlIdx].rdy
s.crossbar.recv[kPreloadCtrlIdx].msg @= \
NocPktType(controller_id,
controller/ControllerRTL.py
Outdated
@@ -20,7 +20,7 @@ | |||
|
|||
class ControllerRTL(Component): | |||
|
|||
def construct(s, ControllerIdType, CmdType, CtrlPktType, NocPktType, | |||
def construct(s, ControllerIdType, CmdType, PreloadPktType, NocPktType, |
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.
Rename PreloadPktType
to FromCpuPktType
?
controller/ControllerRTL.py
Outdated
|
||
@update | ||
def update_received_msg(): | ||
kLoadRequestInportIdx = 0 | ||
kLoadResponseInportIdx = 1 | ||
kStoreRequestInportIdx = 2 | ||
kPreloadCtrlIdx = 3 |
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.
kPreloadCtrlIdx
-> kFromCpuCtrlIdx
?
controller/ControllerRTL.py
Outdated
|
||
@update | ||
def update_received_msg(): | ||
kLoadRequestInportIdx = 0 | ||
kLoadResponseInportIdx = 1 | ||
kStoreRequestInportIdx = 2 | ||
kPreloadCtrlIdx = 3 | ||
kPreloaDataIdx = 4 |
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.
kPreloaDataIdx
-> kFromCpuDataIdx
?
No description provided.