diff --git a/src/main/java/ui/window/JDialogCPUNode.java b/src/main/java/ui/window/JDialogCPUNode.java index e58ab408c13d9c42815d4c4a58cfa93a403fd3f3..5b274d70aac77d9f32110ef499713c7e6a0df91c 100644 --- a/src/main/java/ui/window/JDialogCPUNode.java +++ b/src/main/java/ui/window/JDialogCPUNode.java @@ -42,7 +42,10 @@ package ui.window; import cli.Action; +import help.HelpEntry; +import help.HelpManager; import myutil.GraphicLib; +import myutil.TraceManager; import tmltranslator.modelcompiler.ArchUnitMEC; import ui.ColorManager; import ui.util.IconManager; @@ -93,8 +96,8 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener { private java.util.List<SimulationTransaction> transactions; //issue 183 - List<JTextArea> instructionHelpList; - List<JButton> buttons; + List<JButton> buttons = new ArrayList<>(); + List<HelpEntry> helpEntries; /* Creates new form */ public JDialogCPUNode(Frame _frame, String _title, TMLArchiCPUNode _node, ArchUnitMEC _MECType, java.util.List<SimulationTransaction> _transactions) { @@ -121,114 +124,82 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener { } //issue 183 - private void buttonClick(JButton but, JTextArea jta) { - JPopupMenu helpPopup = new JPopupMenu(); - helpPopup.add(jta); - but.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - - if (!helpPopup.isVisible()) { - helpPopup.show(but,20,20); - } else { - helpPopup.setVisible(false); - } - } - }); - - helpPopup.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "closeJTextArea"); - helpPopup.getActionMap().put("closeJTextArea", new AbstractAction() { + private void buttonClick(JButton but, HelpEntry he, HelpManager hm) { + but.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - helpPopup.setVisible(false); + JFrameHelp jhf = new JFrameHelp("help", hm, he); + jhf.setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE); + //jhf.setAutoRequestFocus(true); + //jhf.setFocusableWindowState(true); + but.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close"); + but.getActionMap().put("close", new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + if(!jhf.isVisible()) + dispose(); + jhf.setVisible(false); + } + }); } }); - } //issue 183 private void hardwareHelp(){ - instructionHelpList = new ArrayList<>(); - buttons = new ArrayList<>(); - JTextArea jft1 = new JTextArea(); - jft1.setText("CPU name"); - instructionHelpList.add(jft1); - - JTextArea jft2 = new JTextArea(); - jft2.setText("The arbitration policy used by OS to schedule mapped tasks"); - instructionHelpList.add(jft2); - - JTextArea jft3 = new JTextArea("Slice time : The maximum time allocated by the OS " + - "scheduler to execute a task"); - instructionHelpList.add(jft3); - - JTextArea jft4 = new JTextArea("Nb of Cores : The number of cores of the CPU"); - instructionHelpList.add(jft4); - - JTextArea jft5 = new JTextArea("Data size : The size of an EXECI/EXECC operation, in " + - "number of bytes"); - instructionHelpList.add(jft5); - - JTextArea jft6 = new JTextArea("Pipeline size : The number of stages of the pipeline"); - instructionHelpList.add(jft6); - - JTextArea jft7 = new JTextArea("Task switching : The time taken by the OS for a context switch"); - instructionHelpList.add(jft7); - - JTextArea jft8 = new JTextArea("Mis-branching prediction: The miss percentage of the CPU branch " + - "prediction scheme"); - instructionHelpList.add(jft8); - - JTextArea jft9 = new JTextArea("cahe-miss : The percentage of cache misses"); - instructionHelpList.add(jft9); - - JTextArea jft10 = new JTextArea("Go idle time (cycles) : The time taken by the OS and the CPU " + - "hardware to go idle"); - instructionHelpList.add(jft10); - - JTextArea jft11 = new JTextArea("Max consecutive cycles before idle (cycles) : Number of consecutive cycles of NOPs before the " + - "CPU goes idle"); - instructionHelpList.add(jft11); - - JTextArea jft12 = new JTextArea("EXECI execution : The number of clock cycles corresponding to an " + - "integer operation"); - instructionHelpList.add(jft12); - - JTextArea jft13 = new JTextArea("EXECC execution : The number of clock cycles corresponding to an " + - "operation on complex numbers"); - instructionHelpList.add(jft13); - - JTextArea jft14 = new JTextArea("Clock divider : This number defines the operating clock frequency of the CPU \n" + - "It is expressed via a number that is used to divide the global design\n" + - "frequency, whose default value is 200 MHz. Thus a clock divider equal to 4 means that the CPU\n" + - "operates at 200/4 = 50 MHz"); - instructionHelpList.add(jft14); - - JTextArea jft15 = new JTextArea("Encryption"); - instructionHelpList.add(jft15); - - JTextArea jft16 = new JTextArea("CPU Extension Construct"); - instructionHelpList.add(jft16); - - JTextArea jft17 = new JTextArea("Operation"); - instructionHelpList.add(jft17); + HelpManager helpManager = new HelpManager(); + + if(helpManager.loadEntries()) { + helpEntries = new ArrayList<>(); + HelpEntry he0 = helpManager.getHelpEntryWithHTMLFile("cpuname.html"); + helpEntries.add(he0); + HelpEntry he1 = helpManager.getHelpEntryWithHTMLFile("schedulingpolicy.html"); + helpEntries.add(he1); + HelpEntry he2 = helpManager.getHelpEntryWithHTMLFile("slicetime.html"); + helpEntries.add(he2); + HelpEntry he3 = helpManager.getHelpEntryWithHTMLFile("numbercores.html"); + helpEntries.add(he3); + HelpEntry he4 = helpManager.getHelpEntryWithHTMLFile("datasize.html"); + helpEntries.add(he4); + HelpEntry he5 = helpManager.getHelpEntryWithHTMLFile("pipelinesize.html"); + helpEntries.add(he5); + HelpEntry he6 = helpManager.getHelpEntryWithHTMLFile("taskswitchingtime.html"); + helpEntries.add(he6); + HelpEntry he7 = helpManager.getHelpEntryWithHTMLFile("misbrandingprediction.html"); + helpEntries.add(he7); + HelpEntry he8 = helpManager.getHelpEntryWithHTMLFile("cachemiss.html"); + helpEntries.add(he8); + HelpEntry he9 = helpManager.getHelpEntryWithHTMLFile("goidletime.html"); + helpEntries.add(he9); + HelpEntry he10 = helpManager.getHelpEntryWithHTMLFile("maxconsecutivecycles.html"); + helpEntries.add(he10); + HelpEntry he11 = helpManager.getHelpEntryWithHTMLFile("execi.html"); + helpEntries.add(he11); + HelpEntry he12 = helpManager.getHelpEntryWithHTMLFile("execc.html"); + helpEntries.add(he12); + HelpEntry he13 = helpManager.getHelpEntryWithHTMLFile("clockdivider.html"); + helpEntries.add(he13); + HelpEntry he14 = helpManager.getHelpEntryWithHTMLFile("encryption.html"); + helpEntries.add(he14); + HelpEntry he15 = helpManager.getHelpEntryWithHTMLFile("operation.html"); + helpEntries.add(he15); + HelpEntry he16 = helpManager.getHelpEntryWithHTMLFile("cpuextension.html"); + helpEntries.add(he16); + } - for(int i = 0; i < instructionHelpList.size(); i++) { + for(int i = 0; i < 17; i++) { Icon myIcon = IconManager.imgic32; JButton but = new JButton(myIcon); setButton(but); + buttonClick(but,helpEntries.get(i),helpManager); buttons.add(but); - instructionHelpList.get(i).setEditable(false); - } - - for (int i = 0; i < instructionHelpList.size(); i++) { - buttonClick(buttons.get(i),instructionHelpList.get(i)); } } private void initComponents() { + hardwareHelp(); Container c = getContentPane(); GridBagLayout gridbag0 = new GridBagLayout(); GridBagLayout gridbag2 = new GridBagLayout(); @@ -237,7 +208,6 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener { //GridBagConstraints c1 = new GridBagConstraints(); GridBagConstraints c2 = new GridBagConstraints(); GridBagConstraints c4 = new GridBagConstraints(); - hardwareHelp(); setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(gridbag0); @@ -290,7 +260,7 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener { c2.weighty = 0.5; c2.weightx = 0.5; c2.gridwidth = GridBagConstraints.REMAINDER; - panel2.add(buttons.get(1),c2); + panel2.add(buttons.get(1),c2); c2.gridwidth = 1; //issue 183 diff --git a/src/main/resources/help/cachemiss.md b/src/main/resources/help/cachemiss.md new file mode 100644 index 0000000000000000000000000000000000000000..de77c804bb7b2a49e115fbc52573e2954e95a835 --- /dev/null +++ b/src/main/resources/help/cachemiss.md @@ -0,0 +1,2 @@ +##Cahe-miss +The percentage of cache misses \ No newline at end of file diff --git a/src/main/resources/help/cpuextension.md b/src/main/resources/help/cpuextension.md new file mode 100644 index 0000000000000000000000000000000000000000..c9994ae6b197c446e364dc5cff2845eda2232b15 --- /dev/null +++ b/src/main/resources/help/cpuextension.md @@ -0,0 +1 @@ +CPU Extension Construct \ No newline at end of file diff --git a/src/main/resources/help/cpuname.md b/src/main/resources/help/cpuname.md new file mode 100644 index 0000000000000000000000000000000000000000..3572cf7ad0b55c777aec0e287178161c1bf35614 --- /dev/null +++ b/src/main/resources/help/cpuname.md @@ -0,0 +1 @@ +The CPU node name \ No newline at end of file diff --git a/src/main/resources/help/datasize.md b/src/main/resources/help/datasize.md new file mode 100644 index 0000000000000000000000000000000000000000..affbb80116ee8b26f5f020930afc7b13aa47fbd9 --- /dev/null +++ b/src/main/resources/help/datasize.md @@ -0,0 +1,2 @@ +## Data size +The size of an EXECI/EXECC operation, in number of bytes \ No newline at end of file diff --git a/src/main/resources/help/encryption.md b/src/main/resources/help/encryption.md new file mode 100644 index 0000000000000000000000000000000000000000..ce802704a5353936c1b3d59427209117c107fb7b --- /dev/null +++ b/src/main/resources/help/encryption.md @@ -0,0 +1 @@ +Encryption \ No newline at end of file diff --git a/src/main/resources/help/execc.md b/src/main/resources/help/execc.md new file mode 100644 index 0000000000000000000000000000000000000000..d9320616d333fef62a6bfb424bc4e3f1cb53d1ac --- /dev/null +++ b/src/main/resources/help/execc.md @@ -0,0 +1,2 @@ +##EXECC execution +The number of clock cycles corresponding to an operation on complex numbers \ No newline at end of file diff --git a/src/main/resources/help/execi.md b/src/main/resources/help/execi.md new file mode 100644 index 0000000000000000000000000000000000000000..c4b0895671f02b1ae75b6f96047bb78b31704086 --- /dev/null +++ b/src/main/resources/help/execi.md @@ -0,0 +1,2 @@ +##EXECI execution +The number of clock cycles corresponding to an integer operation \ No newline at end of file diff --git a/src/main/resources/help/goidletime.md b/src/main/resources/help/goidletime.md new file mode 100644 index 0000000000000000000000000000000000000000..8a6c8989eeb9a0333199f6c5f41db0a9a07dd803 --- /dev/null +++ b/src/main/resources/help/goidletime.md @@ -0,0 +1 @@ +Go idle time (cycles) : The time taken by the OS and the CPU hardware to go idle \ No newline at end of file diff --git a/src/main/resources/help/helpTable.txt b/src/main/resources/help/helpTable.txt index 5f85c7f91faec3f240bcf8c80abc2d9bcf745592..49f22de0e8eabee19d316796eaf392a7cfc6bba3 100644 --- a/src/main/resources/help/helpTable.txt +++ b/src/main/resources/help/helpTable.txt @@ -3,8 +3,26 @@ - diplodocus diplodocus hardware software partitioning dse design space exploration -- architecture architecture hardware os operating system --- cpu cpu processor cpu os + +----cpuname cpu_name cpu name +----schedulingpolicy scheduling_policy scheduling policy cpu +----slicetime slice_time slice time cpu +----numbercores number_of_core number core cpu +----datasize data_size data size cpu +----pipelinesize pipeline_size pipeline size cpu +----taskswitchingtime task_switching_time task switching time cpu +----misbrandingprediction mis-branding_prediction mis branding prediction cpu +----cachemiss cache_miss cache miss cpu +----goidletime go_idle_time go idle time cpu +----maxconsecutivecycles max_consecutive_cycles_before_idle max consecutive cycles before idle cpu +----execi execi_execution_time execi execution time cpu +----execc execc_execution_time execc execution time cpu ----clockdivider clock_divider clock divider cpu --- mapping mapping tasks communication mapping +----encryption encryption encryption cpu +----operation operation operation cpu +----cpuextension cpu_extension_construct cpu extension construct + +-- mapping mapping tasks communication mapping ---taskmapping taskmapping tasks mapping ---communicationmapping communicationmapping communication mapping - avatar avatar software embedded systems safety security diff --git a/src/main/resources/help/maxconsecutivecycles.md b/src/main/resources/help/maxconsecutivecycles.md new file mode 100644 index 0000000000000000000000000000000000000000..f928b1e8ce6b145de7ff46360196381f957f8cd7 --- /dev/null +++ b/src/main/resources/help/maxconsecutivecycles.md @@ -0,0 +1,2 @@ +##Max consecutive cycles before idle (cycles) +Number of consecutive cycles of NOPs before the CPU goes idle \ No newline at end of file diff --git a/src/main/resources/help/misbrandingprediction.md b/src/main/resources/help/misbrandingprediction.md new file mode 100644 index 0000000000000000000000000000000000000000..7ad2301712715e54e43dc92a862730d2e2110a78 --- /dev/null +++ b/src/main/resources/help/misbrandingprediction.md @@ -0,0 +1,2 @@ +##Mis-branching prediction +The miss percentage of the CPU branch prediction scheme \ No newline at end of file diff --git a/src/main/resources/help/numbercores.md b/src/main/resources/help/numbercores.md new file mode 100644 index 0000000000000000000000000000000000000000..0c97e0d83376486a2520db9e33f35fb9d7e91581 --- /dev/null +++ b/src/main/resources/help/numbercores.md @@ -0,0 +1,2 @@ +## Nb of Cores +The number of cores of the CPU \ No newline at end of file diff --git a/src/main/resources/help/operation.md b/src/main/resources/help/operation.md new file mode 100644 index 0000000000000000000000000000000000000000..123a32db006382749d0b27fda6496ccd857c4777 --- /dev/null +++ b/src/main/resources/help/operation.md @@ -0,0 +1 @@ +Operation \ No newline at end of file diff --git a/src/main/resources/help/pipelinesize.md b/src/main/resources/help/pipelinesize.md new file mode 100644 index 0000000000000000000000000000000000000000..8f62c3e80ee92aafd98991c8fda88b83664b185a --- /dev/null +++ b/src/main/resources/help/pipelinesize.md @@ -0,0 +1,2 @@ +## Pipeline size +The number of stages of the pipeline \ No newline at end of file diff --git a/src/main/resources/help/schedulingpolicy.md b/src/main/resources/help/schedulingpolicy.md new file mode 100644 index 0000000000000000000000000000000000000000..e0463aad242f264614ea77a4535902b3cb0b1cf6 --- /dev/null +++ b/src/main/resources/help/schedulingpolicy.md @@ -0,0 +1 @@ +The arbitration policy used by OS to schedule mapped tasks \ No newline at end of file diff --git a/src/main/resources/help/slicetime.md b/src/main/resources/help/slicetime.md new file mode 100644 index 0000000000000000000000000000000000000000..cf18a3ca80810dd109d48e5de500647a1437c7d1 --- /dev/null +++ b/src/main/resources/help/slicetime.md @@ -0,0 +1,2 @@ +## slice time +The maximum time allocated by the OS scheduler to execute a task \ No newline at end of file diff --git a/src/main/resources/help/taskswitchingtime.md b/src/main/resources/help/taskswitchingtime.md new file mode 100644 index 0000000000000000000000000000000000000000..f7cd2a20909ef0cae8d6612ae8998a51584aa7c5 --- /dev/null +++ b/src/main/resources/help/taskswitchingtime.md @@ -0,0 +1,2 @@ +##Task switching time +The time taken by the OS for a context switch \ No newline at end of file