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

GUI v9.0 #28

Merged
merged 10 commits into from
Jun 13, 2024
47 changes: 26 additions & 21 deletions launchUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def window_size(window, width, height):
window.geometry(f"{width}x{height}")
master = tkinter.Tk()
master.title("CGRA-Flow: An Integrated End-to-End Framework for CGRA Exploration, Compilation, and Development")
default_width = 1725
default_height = 970
default_width = 1723
default_height = 900
Wang-yuanlu marked this conversation as resolved.
Show resolved Hide resolved
window_size(master, default_width, default_height)
master.grid_rowconfigure(0, weight=2)
master.grid_rowconfigure(1, weight=3)
Expand Down Expand Up @@ -669,7 +669,7 @@ def leave(event):
def clickTile(ID):
widgets["fuConfigPannel"].config(text='Tile '+str(ID)+' functional units')
widgets["xbarConfigPannel"].config(text='Tile '+str(ID)+' crossbar outgoing links')
widgets["xbarConfigPannel"].grid(columnspan=4, row=7, column=0,rowspan=2)
widgets["xbarConfigPannel"].grid(columnspan=4, row=7, column=0,rowspan=2,sticky="nsew")
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a comment here about the meaning of "nsew"?

Copy link
Author

Choose a reason for hiding this comment

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

Yes. In this sentence "nsew" means that each xbar component will fill the corresponding grid space. Similar usage is seen in the subsequent code.

widgets["entireTileCheckbutton"].config(text='Disable entire Tile '+str(ID), state="normal")
widgets["spmConfigPannel"].grid_forget()
paramCGRA.targetTileID = ID
Expand All @@ -696,7 +696,7 @@ def clickSPM():

spmConfigPannel = widgets["spmConfigPannel"]
spmConfigPannel.config(text='DataSPM outgoing links')
spmConfigPannel.grid(row=7,column=0,rowspan=2,columnspan=4)
spmConfigPannel.grid(row=7,column=0,rowspan=2,columnspan=4,sticky="nsew")

Wang-yuanlu marked this conversation as resolved.
Show resolved Hide resolved
spmEnabledListbox = widgets["spmEnabledListbox"]
spmDisabledListbox = widgets["spmDisabledListbox"]
Expand Down Expand Up @@ -1430,12 +1430,10 @@ def create_cgra_pannel(master, rows, columns):
cgraPannel = tkinter.LabelFrame(master, text='CGRA', bd=BORDER, relief='groove')
cgraPannel.grid(row=0, column=0, rowspan=1,columnspan=1, sticky="nsew")
canvas = tkinter.Canvas(cgraPannel)
widgets["canvas"] = canvas
#canvas = tkinter.Canvas(master)
#canvas.grid(row=0,column=0,rowspan=3,columnspan=2,sticky="nsew")
canvas.pack(side="top", fill="both", expand=True)
hbar = tkinter.Scrollbar(cgraPannel, orient="horizontal", command=canvas.xview)
hbar.pack(side="bottom", fill="x")
canvas.config(xscrollcommand=hbar.set)
baseX = 0

# pad contains tile and links
# padSize = TILE_SIZE + LINK_LENGTH
Expand All @@ -1449,9 +1447,9 @@ def create_cgra_pannel(master, rows, columns):

# draw data memory
memHeight = GRID_HEIGHT
button = tkinter.Button(canvas, text = "Data\nSPM", fg = 'black', bg = 'gray', relief = 'raised', bd = BORDER, command = clickSPM)
button.place(height=memHeight, width=MEM_WIDTH, x = 25, y = 35)

spmLabel = tkinter.Button(canvas, text = "Data\nSPM", fg = 'black', bg = 'gray', relief = 'raised', bd = BORDER, command = clickSPM)
#button.place(height=memHeight, width=MEM_WIDTH, x = 25, y = 35)
canvas.create_window(baseX+BORDER, BORDER, window=spmLabel, height=GRID_HEIGHT, width=MEM_WIDTH, anchor="nw")
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a comment explaining the anchor?

Copy link
Owner

@tancheng tancheng Jun 12, 2024

Choose a reason for hiding this comment

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

Comment on anchor.

Didn't see how this is resolved? Once you resolve a comment, can you please reply in this dialogue window (instead of just closing it), so it is more clear to the reviewer?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I forgot this one. Here I use anchor="nw" to express that the data memory will be placed in the upper left corner of the cgrapannel. This way, it will be adaptive to changes in window size.


# construct tiles
if len(paramCGRA.tiles) == 0:
Expand All @@ -1469,7 +1467,7 @@ def create_cgra_pannel(master, rows, columns):
if not tile.disabled:
button = tkinter.Button(canvas, text = "Tile "+str(tile.ID), fg='black', bg='gray', relief='raised', bd=BORDER, command=partial(clickTile, tile.ID))
posX, posY = tile.getPosXY()
button.place(height=TILE_HEIGHT, width=TILE_WIDTH, x = posX + 25, y = posY + 35)
canvas.create_window(posX, posY, window=button, height=TILE_HEIGHT, width=TILE_WIDTH, anchor="nw")


# construct links
Expand Down Expand Up @@ -1531,8 +1529,13 @@ def create_cgra_pannel(master, rows, columns):
else:
srcX, srcY = link.getSrcXY()
dstX, dstY = link.getDstXY()
canvas.create_line(srcX + 25, srcY + 35, dstX + 25, dstY + 35, arrow=tkinter.LAST)

canvas.create_line(srcX, srcY, dstX, dstY, arrow=tkinter.LAST)

canvas.pack(side="top", fill="both", expand=True)
hbar = tkinter.Scrollbar(cgraPannel, orient="horizontal", command=canvas.xview)
hbar.pack(side="bottom", fill="x")
canvas.config(xscrollcommand=hbar.set)
canvas.config(scrollregion=canvas.bbox("all"))

def place_fu_options(master):
fuCount = len(fuTypeList)
Expand All @@ -1543,7 +1546,7 @@ def place_fu_options(master):
fuCheckbuttons[fuTypeList[i]] = fuCheckbutton
fuCheckbutton.select()
paramCGRA.updateFuCheckbutton(fuTypeList[i], fuVar.get())
fuCheckbutton.grid(row=i//4, column=i%4, padx=15, pady=15, sticky="nsew")
fuCheckbutton.grid(row=i//4, column=i%4, padx=33, pady=30, sticky="nsew")

def place_xbar_options(master):
for i in range(PORT_DIRECTION_COUNTS):
Expand Down Expand Up @@ -1616,19 +1619,19 @@ def create_param_pannel(master):
place_fu_options(fuConfigPannel)

xbarConfigPannel = tkinter.LabelFrame(paramPannel, text='Tile 0 crossbar outgoing links', bd=BORDER, relief='groove')
xbarConfigPannel.grid(columnspan=4, row=7, column=0,rowspan=2)
xbarConfigPannel.grid(columnspan=4, row=7, column=0,rowspan=2,sticky="nsew")
widgets["xbarConfigPannel"] = xbarConfigPannel
place_xbar_options(xbarConfigPannel)
place_xbar_options(xbarConfigPannel)

spmConfigPannel = tkinter.LabelFrame(paramPannel, text='Data SPM outgoing links', bd=BORDER, relief='groove')
spmConfigPannel.grid(row=7,column=0,rowspan=2,columnspan=4)
spmConfigPannel.grid(row=7,column=0,rowspan=2,columnspan=4,sticky="nsew")
widgets["spmConfigPannel"] = spmConfigPannel
for i in range(3):
spmConfigPannel.rowconfigure(i,weight=1)

spmConfigPannel.columnconfigure(0,weight=2)
spmConfigPannel.columnconfigure(0,weight=1)
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a comment here about what are the columnconfigure used for?

Copy link
Author

Choose a reason for hiding this comment

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

Yes. Here the columnconfigure means that the spmConfigPannel will be evenly divided into three columns, and each column will fill the corresponding grid space.

spmConfigPannel.columnconfigure(1,weight=1)
spmConfigPannel.columnconfigure(2,weight=2)
spmConfigPannel.columnconfigure(2,weight=1)
spmConfigPannel.columnconfigure(3,weight=1)
spmConfigPannel.columnconfigure(4,weight=2)

Expand All @@ -1653,7 +1656,7 @@ def create_param_pannel(master):
spmEnabledListbox.config(yscrollcommand=spmEnabledScrollbar.set)
spmDisabledScrollbar.config(command=spmDisabledListbox.yview)
spmDisabledListbox.config(yscrollcommand=spmDisabledScrollbar.set)
spmEnabledLabel.grid(row=0,column=0,rowspan=3,sticky="new")
spmEnabledLabel.grid(row=0,column=0,rowspan=3,sticky="nsew")

spmEnabledScrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
spmEnabledListbox.pack()
Expand Down Expand Up @@ -1684,6 +1687,8 @@ def create_param_pannel(master):
else:
spmDisabledListbox.insert(0, port)


Wang-yuanlu marked this conversation as resolved.
Show resolved Hide resolved



def create_test_pannel(master):
Expand Down
Loading