Commit 30f5e7727105648eabcbbbdb660d83b54d2a7491

Authored by Brice Colombier
1 parent b5d7efe24a
Exists in master

Modify paths loaded in masking

Showing 4 changed files with 35 additions and 15 deletions

GUI/add_frame_elements.py View file @ 30f5e77
... ... @@ -194,8 +194,9 @@
194 194 sticky=W,
195 195 padx=5)
196 196 self.modify_design_button=Button(self.modify_design_frame,
197   - text="Modify design",
198   - state="disabled")
  197 + text="Modify design",
  198 + state="disabled",
  199 + command=self.modify_design)
199 200 self.modify_design_button.grid(row=2, column=0)
200 201 # -------------------------------------------------------
201 202 self.generate_modified_design_button=Button(self.generate_modified_design_frame,
GUI/declare_pack_frames.py View file @ 30f5e77
... ... @@ -10,7 +10,7 @@
10 10 from ttk import *
11 11  
12 12  
13   -def declare_pack_frames(self, tab_logic_modifier, tab_activation):
  13 +def declare_pack_frames(self, tab_logic_modifier, tab_enrolment, tab_activation):
14 14  
15 15 """Declare the main GUI frames and pack them"""
16 16  
GUI/tabbed_app.py View file @ 30f5e77
  1 +# -*- coding: utf-8 -*-
  2 +
1 3 # Author: Brice Colombier
2 4 # Laboratoire Hubert Curien
3 5 # 42000 Saint-Etienne - France
... ... @@ -17,6 +19,11 @@
17 19 import add_frame_elements
18 20  
19 21  
  22 +import sys
  23 +sys.path.append("../Masking/")
  24 +import masking
  25 +sys.path.append("../Locking/")
  26 +import locking
20 27 class App:
21 28  
22 29 """Main class for the demonstrator GUI app"""
23 30  
24 31  
25 32  
... ... @@ -27,18 +34,20 @@
27 34 s.configure("Green.TLabelframe.Label",
28 35 foreground="darkgreen")
29 36  
30   - master.maxsize(width=770, height=480)
31   - master.minsize(width=770, height=480)
  37 + master.maxsize(width=770, height=280)
  38 + master.minsize(width=770, height=280)
32 39 master.resizable(width=False, height=False)
33   - master.title("SALWARE IP protection")
  40 + master.title("SALWARE IP protection tool")
34 41 master.iconbitmap(default='icon.ico')
35 42  
36 43 # Tabs bar
37 44 note = Notebook(master)
38 45 tab_logic_modifier = Frame(note)
39   - note.add(tab_logic_modifier, text="Logic modifier", compound=TOP)
  46 + note.add(tab_logic_modifier, text="Logic modifier", padding=[0, 5, 0, 0])
  47 + tab_enrolment = Frame(note)
  48 + note.add(tab_enrolment, text="Enrolment", padding=[0, 5, 0, 0])
40 49 tab_activation = Frame(note)
41   - note.add(tab_activation, text="Activation")
  50 + note.add(tab_activation, text="Activation", padding=[0, 5, 0, 0])
42 51 note.pack()
43 52  
44 53 # Menu bar
... ... @@ -48,7 +57,7 @@
48 57 declare_initialize_variables.declare_initialize_variables(self)
49 58  
50 59 # Frames
51   - declare_pack_frames.declare_pack_frames(self, tab_logic_modifier, tab_activation)
  60 + declare_pack_frames.declare_pack_frames(self, tab_logic_modifier, tab_activation, tab_enrolment)
52 61  
53 62 # Frame elements
54 63 add_frame_elements.add_frame_elements(self)
... ... @@ -64,7 +73,6 @@
64 73 ("Structural VHDL files", ".vhd"),
65 74 ("RTL Verilog files", ".v"),
66 75 ("Structural Verilog files", ".v")]
67   -
68 76 self.filepath.set(tkFileDialog.askopenfilename(filetypes=ftypes))
69 77 if self.filepath.get():
70 78 self.filename.set(self.filepath.get().split("/")[-1])
... ... @@ -110,7 +118,13 @@
110 118 self.top = Toplevel()
111 119 self.top.title("About")
112 120  
113   - self.msg = Label(self.top, text="About")
  121 + self.msg = Label(self.top, text="This software was realised in the frame of\n\
  122 +the SALWARE project number ANR-13-JS03-0003\n\
  123 +supported by the French \"Agence Nationale de\n\
  124 +la Recherche\" and by the French \"Fondation de\n\
  125 +Recherche pour l'Aéronautique et l'Espace\",\n\
  126 +funding for this project was also provided by\n\
  127 +a grant from \"La Région Rhône-Alpes\".", background="white")
114 128 self.msg.pack()
115 129  
116 130 def pop_up_license(self):
... ... @@ -139,6 +153,11 @@
139 153 self.com_port_status_text.configure(text="Disconnected",
140 154 foreground="red")
141 155  
  156 + def modify_design(self, g, prim_in, prim_out, nodes):
  157 + if self.locking.get():
  158 + locking.locking(g, prim_in, prim_out, nodes, self.locking_overhead)
  159 + if self.masking.get():
  160 + masking.masking(g, prim_in, prim_out, nodes, self.masking_overhead, self.masking_heuristic)
142 161  
143 162 def every_second():
144 163 if str(app.com_port_status_text.cget("foreground")) == "red":
Masking/masking.py View file @ 30f5e77
... ... @@ -15,7 +15,7 @@
15 15 """
16 16  
17 17 import sys
18   -sys.path.append("../Designs/Demonstrator/Parsers/")
  18 +sys.path.append("../Parsers/")
19 19  
20 20 import build_bench
21 21 import build_blif
... ... @@ -40,7 +40,7 @@
40 40  
41 41 import numpy as np
42 42  
43   -def masking(g, name, prim_in, prim_out, nodes, overhead, heuristic):
  43 +def masking(g, prim_in, prim_out, nodes, overhead, heuristic):
44 44  
45 45 h = g.copy() #Perform deep copy
46 46 key_size = int(len(nodes)*overhead)
... ... @@ -81,6 +81,6 @@
81 81 "current_flow_betweenness"]:
82 82 g, prim_in, prim_out, nodes = build_bench.build(name)
83 83 print heuristic
84   - _, b = masking(g, name, prim_in, prim_out, nodes, overhead, heuristic)
  84 + _, b = masking(g, prim_in, prim_out, nodes, overhead, heuristic)
85 85 print b