diff --git a/src/tmltranslator/ctranslator/AdaifBuffer.java b/src/tmltranslator/ctranslator/AdaifBuffer.java index 4f820833121595f2dd53b163960127955e4fdbe2..8e9727bd71fa0ba4a0edb15d146a3e12bd1aac53 100644 --- a/src/tmltranslator/ctranslator/AdaifBuffer.java +++ b/src/tmltranslator/ctranslator/AdaifBuffer.java @@ -74,6 +74,7 @@ public class AdaifBuffer extends Buffer { private String Context = "embb_mainmemory_context"; + private static ArrayList<String> bufferParams = new ArrayList<String>(); //the DS that collects all the above params private static final int MAX_PARAMETERS = 2; private static JTextField numSamplesTF = new JTextField( "", 5 ); private static JTextField baseAddressTF = new JTextField( "", 5 ); @@ -125,8 +126,8 @@ public class AdaifBuffer extends Buffer { sb.append("\" baseAddress=\"" + buffer.get( BASE_ADDRESS_INDEX ) ); } else { - sb.append("\" numSamples=\"" + SP ); - sb.append("\" baseAddress=\"" + SP ); + sb.append("\" numSamples=\"\"" + SP ); + sb.append("baseAddress=\"" ); } return sb.toString(); } @@ -140,7 +141,7 @@ public class AdaifBuffer extends Buffer { return buffer; } - public static ArrayList<JPanel> makePanel( boolean loadBufferParameters, GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { + public static ArrayList<JPanel> makePanel( GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { String baseAddress = "", numSamples = ""; GridBagLayout gridbag2 = new GridBagLayout(); @@ -150,10 +151,10 @@ public class AdaifBuffer extends Buffer { panel.setBorder( new javax.swing.border.TitledBorder("Code generation: memory configuration")); panel.setPreferredSize( new Dimension(650, 350) ); - if( loadBufferParameters ) { - baseAddress = bufferParameters.get( BASE_ADDRESS_INDEX ); - numSamples = bufferParameters.get( NUM_SAMPLES_INDEX ); - } + //retrieve parameters from the buffer + baseAddress = bufferParameters.get( BASE_ADDRESS_INDEX ); + numSamples = bufferParameters.get( NUM_SAMPLES_INDEX ); + c2.anchor = GridBagConstraints.LINE_START; numSamplesTF.setText( numSamples ); panel.add( new JLabel( "Number of samples = "), c2 ); @@ -167,6 +168,8 @@ public class AdaifBuffer extends Buffer { ArrayList<JPanel> panelsList = new ArrayList<JPanel>(); panelsList.add( panel ); + + fillBufferParameters(); //to avoid an empty buffer of parameters if user closes the window without saving return panelsList; } @@ -187,25 +190,37 @@ public class AdaifBuffer extends Buffer { } String regex = "[0-9]+"; String numSamples = (String) numSamplesTF.getText(); - if( !numSamples.matches( regex ) ) { + if( ( numSamples.length() > 0 ) && !numSamples.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The number of samples must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; } - if( Integer.parseInt( numSamples ) == 0 ) { + if( ( numSamples.length() > 0 ) && ( Integer.parseInt( numSamples ) == 0 ) ) { JOptionPane.showMessageDialog( frame, "The number of samples must be greater than 0", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; } - /*if( !( numSamples.length() > 0 ) ) { - return true; - }*/ + + fillBufferParameters(); return true; } - public static void getBufferParameters( ArrayList<String> params ) { - params.add( NUM_SAMPLES_INDEX, numSamplesTF.getText() ); - params.add( BASE_ADDRESS_INDEX, baseAddressTF.getText() ); + private static void fillBufferParameters() { + + if( bufferParams.size() > 0 ) { + bufferParams.set( BUFFER_TYPE_INDEX, String.valueOf( Buffer.AdaifBuffer ) ); + bufferParams.set( NUM_SAMPLES_INDEX, numSamplesTF.getText() ); + bufferParams.set( BASE_ADDRESS_INDEX, baseAddressTF.getText() ); + } + else { + bufferParams.add( BUFFER_TYPE_INDEX, String.valueOf( Buffer.AdaifBuffer ) ); + bufferParams.add( NUM_SAMPLES_INDEX, numSamplesTF.getText() ); + bufferParams.add( BASE_ADDRESS_INDEX, baseAddressTF.getText() ); + } + } + + public static ArrayList<String> getBufferParameters() { + return bufferParams; } } //End of class diff --git a/src/tmltranslator/ctranslator/Buffer.java b/src/tmltranslator/ctranslator/Buffer.java index 28066def59be59d2b5f24d85d2477746dbea490c..6c9aea62c71b198f37292b4b5f00ea7fdcaf74c7 100755 --- a/src/tmltranslator/ctranslator/Buffer.java +++ b/src/tmltranslator/ctranslator/Buffer.java @@ -67,6 +67,8 @@ public class Buffer { public static final int MainMemoryBuffer = 4; public static final int BaseBuffer = 5; + public static final int BUFFER_TYPE_INDEX = 0; + public static final int bufferTypeIndex = 0; public static String CR = "\n"; diff --git a/src/tmltranslator/ctranslator/BufferMEC.java b/src/tmltranslator/ctranslator/BufferMEC.java new file mode 100644 index 0000000000000000000000000000000000000000..08f3457f5855ac9c294d3b8fcdc3f6a38acb137e --- /dev/null +++ b/src/tmltranslator/ctranslator/BufferMEC.java @@ -0,0 +1,69 @@ +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Andrea Enrici + + andrea.enrici AT enstr.fr + + This software is a computer program whose purpose is to allow the + edition of TURTLE analysis, design and deployment diagrams, to + allow the generation of RT-LOTOS or Java code from this diagram, + and at last to allow the analysis of formal validation traces + obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + from INRIA Rhone-Alpes. + + This software is governed by the CeCILL license under French law and + abiding by the rules of distribution of free software. You can use, + modify and/ or redistribute the software under the terms of the CeCILL + license as circulated by CEA, CNRS and INRIA at the following URL + "http://www.cecill.info". + + As a counterpart to the access to the source code and rights to copy, + modify and redistribute granted by the license, users are provided only + with a limited warranty and the software's author, the holder of the + economic rights, and the successive licensors have only limited + liability. + + In this respect, the user's attention is drawn to the risks associated + with loading, using, modifying and/or developing or reproducing the + software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also + therefore means that it is reserved for developers and experienced + professionals having in-depth computer knowledge. Users are therefore + encouraged to load and test the software's suitability as regards their + requirements in conditions enabling the security of their systems and/or + data to be ensured and, more generally, to use and operate it in the + same conditions as regards security. + + The fact that you are presently reading this means that you have had + knowledge of the CeCILL license and that you accept its terms. + + /** + * Class BaseBuffer + * Creation: 11/05/2015 + * @version 1.0 11/05/2015 + * @author Andrea ENRICI + * @see + */ + +package tmltranslator.ctranslator;; + +import java.util.*; +import java.nio.*; +import org.w3c.dom.Element; +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +import myutil.*; +import tmltranslator.*; + +public interface BufferMEC { + + public ArrayList<String> getBufferParameters(); + + public boolean closePanel( Frame frame ); + + public ArrayList<JPanel> makePanel( GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ); + + public ArrayList<String> buildBufferParameters( Element elt ); + + public String appendBufferParameters( ArrayList<String> buffer ); +} diff --git a/src/tmltranslator/ctranslator/FepBuffer.java b/src/tmltranslator/ctranslator/FepBuffer.java index 91e17b2f8cb077ab7f575cef0dcec8bea1d8ced5..42121bb258b29b92c45af4986e26cc3d4bf25ce4 100755 --- a/src/tmltranslator/ctranslator/FepBuffer.java +++ b/src/tmltranslator/ctranslator/FepBuffer.java @@ -78,6 +78,7 @@ public class FepBuffer extends Buffer { protected static final String DATATYPE_TYPE = "uint8_t"; private static final int maxParameters = 4; + private static ArrayList<String> bufferParams = new ArrayList<String>(); //the DS that collects all the above params public static final String DECLARATION = "struct FEP_BUFFER_TYPE {" + CR + TAB + NUM_SAMPLES_TYPE + SP + "num_samples" + SC + CR + TAB + @@ -156,9 +157,9 @@ public class FepBuffer extends Buffer { } else { sb.append("\" baseAddress=\"" + SP ); - sb.append("\" numSamples=\"" + SP ); - sb.append("\" bank=\"" + SP ); - sb.append("\" dataType=\"" + SP ); + sb.append("numSamples=\"\"" + SP ); + sb.append("bank=\"\"" + SP ); + sb.append("dataType=\"" ); } return sb.toString(); } @@ -174,7 +175,7 @@ public class FepBuffer extends Buffer { return buffer; } - public static ArrayList<JPanel> makePanel( boolean loadBufferParameters, GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { + public static ArrayList<JPanel> makePanel( GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { String baseAddress = "", numSamples = "", bank = "", dataType = ""; GridBagLayout gridbag2 = new GridBagLayout(); @@ -185,12 +186,10 @@ public class FepBuffer extends Buffer { panel.setBorder( new javax.swing.border.TitledBorder("Code generation: memory configuration")); panel.setPreferredSize( new Dimension(650, 350) ); - if( loadBufferParameters ) { - baseAddress = bufferParameters.get( BASE_ADDRESS_INDEX ); - numSamples = bufferParameters.get( NUM_SAMPLES_INDEX ); - bank = bufferParameters.get( BANK_INDEX ); - dataType = bufferParameters.get( DATA_TYPE_INDEX ); - } + baseAddress = bufferParameters.get( BASE_ADDRESS_INDEX ); + numSamples = bufferParameters.get( NUM_SAMPLES_INDEX ); + bank = bufferParameters.get( BANK_INDEX ); + dataType = bufferParameters.get( DATA_TYPE_INDEX ); panel.setBorder(new javax.swing.border.TitledBorder("Code generation: memory configuration")); @@ -225,12 +224,17 @@ public class FepBuffer extends Buffer { ArrayList<JPanel> panelsList = new ArrayList<JPanel>(); panelsList.add( panel ); + + fillBufferParameters(); //to avoid an empty buffer of parameters if user closes the window without saving return panelsList; } public static boolean closePanel( Frame frame ) { + String regex = "[0-9]+"; String baseAddress = (String) baseAddressTF.getText(); + String numSamples = (String) numSamplesTF.getText(); + if( baseAddress.length() <= 2 && baseAddress.length() > 0 ) { JOptionPane.showMessageDialog( frame, "Please enter a valid base address", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); @@ -243,9 +247,7 @@ public class FepBuffer extends Buffer { return false; } } - String regex = "[0-9]+"; - String numSamples = (String) numSamplesTF.getText(); - if( !numSamples.matches( regex ) ) { + if( ( numSamples.length() > 0 ) && !numSamples.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The number of samples must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; @@ -255,18 +257,31 @@ public class FepBuffer extends Buffer { JOptionPane.INFORMATION_MESSAGE ); return false; } - if( !( numSamples.length() > 0 ) ) { - return true; - } + + fillBufferParameters(); return true; } - public static void getBufferParameters( ArrayList<String> params ) { - - params.add( NUM_SAMPLES_INDEX, numSamplesTF.getText() ); - params.add( BASE_ADDRESS_INDEX, baseAddressTF.getText() ); - params.add( BANK_INDEX, (String)bankCB.getSelectedItem() ); - params.add( DATA_TYPE_INDEX, (String)dataTypeCB.getSelectedItem() ); + private static void fillBufferParameters() { + + if( bufferParams.size() > 0 ) { + bufferParams.set( BUFFER_TYPE_INDEX, String.valueOf( Buffer.FepBuffer ) ); + bufferParams.set( NUM_SAMPLES_INDEX, numSamplesTF.getText() ); + bufferParams.set( BASE_ADDRESS_INDEX, baseAddressTF.getText() ); + bufferParams.set( BANK_INDEX, (String)bankCB.getSelectedItem() ); + bufferParams.set( DATA_TYPE_INDEX, (String)dataTypeCB.getSelectedItem() ); + } + else { + bufferParams.add( BUFFER_TYPE_INDEX, String.valueOf( Buffer.FepBuffer ) ); + bufferParams.add( NUM_SAMPLES_INDEX, numSamplesTF.getText() ); + bufferParams.add( BASE_ADDRESS_INDEX, baseAddressTF.getText() ); + bufferParams.add( BANK_INDEX, (String)bankCB.getSelectedItem() ); + bufferParams.add( DATA_TYPE_INDEX, (String)dataTypeCB.getSelectedItem() ); + } + } + + public static ArrayList<String> getBufferParameters() { + return bufferParams; } } //End of class diff --git a/src/tmltranslator/ctranslator/InterleaverBuffer.java b/src/tmltranslator/ctranslator/InterleaverBuffer.java index bd890cf9d7c71eb4d2634de188c72305722e0f4e..32d9d42c8046d78a353b6c318e5570a3b6ae91d6 100644 --- a/src/tmltranslator/ctranslator/InterleaverBuffer.java +++ b/src/tmltranslator/ctranslator/InterleaverBuffer.java @@ -101,6 +101,8 @@ public class InterleaverBuffer extends Buffer { public String lengthPermValue = USER_TO_DO; public static String LENGTH_PERM_TYPE = "uint16_t"; + private static ArrayList<String> bufferParams = new ArrayList<String>(); //the DS that collects all the above params + private static final int MAX_PARAMETERS = 9; public static final String DECLARATION = "struct INTERLEAVER_BUFFER_TYPE {" + CR + TAB + @@ -253,22 +255,22 @@ public class InterleaverBuffer extends Buffer { else { //data in sb.append( "\" packedBinaryIn=\"" + SP ); - sb.append( "\" width=\"" + SP ); - sb.append( "\" bitInOffset=\"" + SP ); - sb.append( "\" inputOffset=\"" + SP ); + sb.append( "width=\"\"" + SP ); + sb.append( "bitInOffset=\"\"" + SP ); + sb.append( "inputOffset=\"\"" + SP ); //data out - sb.append( "\" packedBinaryOut=\"" + SP ); - sb.append( "\" bitOutOffset=\"" + SP ); - sb.append( "\" outputOffset=\"" + SP ); + sb.append( "packedBinaryOut=\"\"" + SP ); + sb.append( "bitOutOffset=\"\"" + SP ); + sb.append( "outputOffset=\"\"" + SP ); //permutation table - sb.append( "\" offsetPerm=\"" + SP ); - sb.append( "\" lengthPerm=\"" + SP ); + sb.append( "offsetPerm=\"\"" + SP ); + sb.append( "lengthPerm=\"" ); } return sb.toString(); } - public static ArrayList<JPanel> makePanel( boolean loadBufferParameters, GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { + public static ArrayList<JPanel> makePanel( GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { GridBagLayout gridbag2 = new GridBagLayout(); @@ -287,20 +289,18 @@ public class InterleaverBuffer extends Buffer { panel5.setBorder(new javax.swing.border.TitledBorder("Code generation: Permutation Table configuration")); panel5.setPreferredSize(new Dimension(650, 350)); - if( loadBufferParameters ) { - //data in - packedBinaryIn = bufferParameters.get( PACKED_BINARY_IN_INDEX ); - width = bufferParameters.get( WIDTH_INDEX ); - bitInOffset = bufferParameters.get( BIT_IN_OFFSET_INDEX ); - inputOffset = bufferParameters.get( INPUT_OFFSET_INDEX ); - //data out - packedBinaryOut = bufferParameters.get( PACKED_BINARY_OUT_INDEX ); - bitOutOffset = bufferParameters.get( BIT_OUT_OFFSET_INDEX ); - outputOffset = bufferParameters.get( OUTPUT_OFFSET_INDEX ); - //permutation table - lengthPerm = bufferParameters.get( LENGTH_PERM_INDEX ); - offsetPerm = bufferParameters.get( OFFSET_PERM_INDEX ); - } + //data in + packedBinaryIn = bufferParameters.get( PACKED_BINARY_IN_INDEX ); + width = bufferParameters.get( WIDTH_INDEX ); + bitInOffset = bufferParameters.get( BIT_IN_OFFSET_INDEX ); + inputOffset = bufferParameters.get( INPUT_OFFSET_INDEX ); + //data out + packedBinaryOut = bufferParameters.get( PACKED_BINARY_OUT_INDEX ); + bitOutOffset = bufferParameters.get( BIT_OUT_OFFSET_INDEX ); + outputOffset = bufferParameters.get( OUTPUT_OFFSET_INDEX ); + //permutation table + lengthPerm = bufferParameters.get( LENGTH_PERM_INDEX ); + offsetPerm = bufferParameters.get( OFFSET_PERM_INDEX ); //Data In panel c2.anchor = GridBagConstraints.LINE_START; @@ -367,25 +367,10 @@ public class InterleaverBuffer extends Buffer { panelsList.add( panel4 ); panelsList.add( panel5 ); + fillBufferParameters(); //to avoid an empty buffer of parameters if user closes the window without saving return panelsList; } - public static void getBufferParameters( ArrayList<String> params ) { - - //data in - params.add( PACKED_BINARY_IN_INDEX, packedBinaryIn ); - params.add( WIDTH_INDEX, width ); - params.add( BIT_IN_OFFSET_INDEX, bitInOffset ); - params.add( INPUT_OFFSET_INDEX, inputOffset ); - //data out - params.add( PACKED_BINARY_OUT_INDEX, packedBinaryOut ); - params.add( BIT_OUT_OFFSET_INDEX, bitOutOffset ); - params.add( OUTPUT_OFFSET_INDEX, outputOffset ); - //permutation table - params.add( OFFSET_PERM_INDEX, offsetPerm ); - params.add( LENGTH_PERM_INDEX, lengthPerm ); - } - public static boolean closePanel( Frame frame ) { String regex = "[0-9]+"; @@ -394,26 +379,17 @@ public class InterleaverBuffer extends Buffer { inputOffset = (String)inputOffset_TF.getText(); packedBinaryIn = (String)packedBinaryIn_CB.getSelectedItem(); - /*if( !( width.length() > 0 ) ) { - return true; - }*/ - if( !width.matches( regex ) ) { + if( ( width.length() > 0 ) && !width.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The samples width must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; } - /*if( !( bitInOffset.length() > 0 ) ) { - return true; - }*/ - if( !bitInOffset.matches( regex ) ) { + if( ( bitInOffset.length() > 0 ) && !bitInOffset.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The bit input offset must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; } - /*if( !( inputOffset.length() > 0 ) ) { - return true; - }*/ - if( !inputOffset.matches( regex ) ) { + if( ( inputOffset.length() > 0 ) && !inputOffset.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The bit intput offset must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; @@ -424,19 +400,13 @@ public class InterleaverBuffer extends Buffer { bitOutOffset = (String)bitOutOffset_TF.getText(); outputOffset = (String)outputOffset_TF.getText(); - /*if( !( bitOutOffset.length() > 0 ) ) { - return true; - }*/ - if( !bitOutOffset.matches( regex ) ) { + if( ( bitOutOffset.length() > 0 ) && !bitOutOffset.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The bit output offset must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; } // check output offset - /*if( !( outputOffset.length() > 0 ) ) { - return true; - }*/ - if( !outputOffset.matches( regex ) ) { + if( ( outputOffset.length() > 0 ) && !outputOffset.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The output offset must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; @@ -446,19 +416,12 @@ public class InterleaverBuffer extends Buffer { offsetPerm = (String) offsetPerm_TF.getText(); lengthPerm = (String) lengthPerm_TF.getText(); //check first entry offset - if( !( offsetPerm.length() > 0 ) ) { - return true; - } - if( !offsetPerm.matches( regex ) ) { + if( ( offsetPerm.length() > 0 ) && !offsetPerm.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The offset must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; } - //check permutation table length - /*if( !( lengthPerm.length() > 0 ) ) { - return true; - }*/ - if( !lengthPerm.matches( regex ) ) { + if( ( lengthPerm.length() > 0 ) && !lengthPerm.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The length must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; @@ -469,6 +432,46 @@ public class InterleaverBuffer extends Buffer { return false; } + fillBufferParameters(); return true; } + + private static void fillBufferParameters() { + + if( bufferParams.size() > 0 ) { + bufferParams.set( BUFFER_TYPE_INDEX, String.valueOf( Buffer.InterleaverBuffer ) ); + //data in + bufferParams.set( PACKED_BINARY_IN_INDEX, packedBinaryIn ); + bufferParams.set( WIDTH_INDEX, width ); + bufferParams.set( BIT_IN_OFFSET_INDEX, bitInOffset ); + bufferParams.set( INPUT_OFFSET_INDEX, inputOffset ); + //data out + bufferParams.set( PACKED_BINARY_OUT_INDEX, packedBinaryOut ); + bufferParams.set( BIT_OUT_OFFSET_INDEX, bitOutOffset ); + bufferParams.set( OUTPUT_OFFSET_INDEX, outputOffset ); + //permutation table + bufferParams.set( OFFSET_PERM_INDEX, offsetPerm ); + bufferParams.set( LENGTH_PERM_INDEX, lengthPerm ); + } + else { + bufferParams.add( BUFFER_TYPE_INDEX, String.valueOf( Buffer.InterleaverBuffer ) ); + //data in + bufferParams.add( PACKED_BINARY_IN_INDEX, packedBinaryIn ); + bufferParams.add( WIDTH_INDEX, width ); + bufferParams.add( BIT_IN_OFFSET_INDEX, bitInOffset ); + bufferParams.add( INPUT_OFFSET_INDEX, inputOffset ); + //data out + bufferParams.add( PACKED_BINARY_OUT_INDEX, packedBinaryOut ); + bufferParams.add( BIT_OUT_OFFSET_INDEX, bitOutOffset ); + bufferParams.add( OUTPUT_OFFSET_INDEX, outputOffset ); + //permutation table + bufferParams.add( OFFSET_PERM_INDEX, offsetPerm ); + bufferParams.add( LENGTH_PERM_INDEX, lengthPerm ); + } + } + + public static ArrayList<String> getBufferParameters() { + return bufferParams; + } + } //End of class diff --git a/src/tmltranslator/ctranslator/MMBuffer.java b/src/tmltranslator/ctranslator/MMBuffer.java index 2faed6110c4d5f9f4575223f9d9ee52b296841f1..4f51d2f024941a9596f5aa80a4d635c193314559 100644 --- a/src/tmltranslator/ctranslator/MMBuffer.java +++ b/src/tmltranslator/ctranslator/MMBuffer.java @@ -75,6 +75,7 @@ public class MMBuffer extends Buffer { private String Context = "embb_mainmemory_context"; private static final int MAX_PARAMETERS = 2; + private static ArrayList<String> bufferParams = new ArrayList<String>(); //the DS that collects all the above params private static JTextField numSamplesTF = new JTextField( "", 5 ); private static JTextField baseAddressTF = new JTextField( "", 5 ); @@ -134,13 +135,13 @@ public class MMBuffer extends Buffer { sb.append("\" baseAddress=\"" + buffer.get( BASE_ADDRESS_INDEX ) ); } else { - sb.append("\" numSamples=\"" + SP ); - sb.append("\" baseAddress=\"" + SP ); + sb.append("\" numSamples=\"\"" + SP ); + sb.append( "baseAddress=\"" ); } return sb.toString(); } - public static ArrayList<JPanel> makePanel( boolean loadBufferParameters, GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { + public static ArrayList<JPanel> makePanel( GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { String baseAddress = "", numSamples = ""; GridBagLayout gridbag2 = new GridBagLayout(); @@ -150,10 +151,9 @@ public class MMBuffer extends Buffer { panel.setBorder( new javax.swing.border.TitledBorder("Code generation: memory configuration")); panel.setPreferredSize( new Dimension(650, 350) ); - if( loadBufferParameters ) { - baseAddress = bufferParameters.get( BASE_ADDRESS_INDEX ); - numSamples = bufferParameters.get( NUM_SAMPLES_INDEX ); - } + baseAddress = bufferParameters.get( BASE_ADDRESS_INDEX ); + numSamples = bufferParameters.get( NUM_SAMPLES_INDEX ); + c2.anchor = GridBagConstraints.LINE_START; numSamplesTF.setText( numSamples ); panel.add( new JLabel( "Number of samples = "), c2 ); @@ -167,17 +167,17 @@ public class MMBuffer extends Buffer { ArrayList<JPanel> panelsList = new ArrayList<JPanel>(); panelsList.add( panel ); - return panelsList; - } - public static void getBufferParameters( ArrayList<String> params ) { - params.add( NUM_SAMPLES_INDEX, numSamplesTF.getText() ); - params.add( BASE_ADDRESS_INDEX, baseAddressTF.getText() ); + fillBufferParameters(); //to avoid an empty buffer of parameters if user closes the window without saving + return panelsList; } public static boolean closePanel( Frame frame ) { + String regex = "[0-9]+"; String baseAddress = (String) baseAddressTF.getText(); + String numSamples = (String) numSamplesTF.getText(); + if( baseAddress.length() <= 2 && baseAddress.length() > 0 ) { JOptionPane.showMessageDialog( frame, "Please enter a valid base address", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); @@ -190,9 +190,7 @@ public class MMBuffer extends Buffer { return false; } } - String regex = "[0-9]+"; - String numSamples = (String) numSamplesTF.getText(); - if( !numSamples.matches( regex ) ) { + if( ( numSamples.length() > 0 ) && !numSamples.matches( regex ) ) { JOptionPane.showMessageDialog( frame, "The number of samples must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; @@ -202,9 +200,27 @@ public class MMBuffer extends Buffer { JOptionPane.INFORMATION_MESSAGE ); return false; } - /*if( !( numSamples.length() > 0 ) ) { - return true; - }*/ + + fillBufferParameters(); return true; } + + private static void fillBufferParameters() { + + if( bufferParams.size() > 0 ) { + bufferParams.set( BUFFER_TYPE_INDEX, String.valueOf( Buffer.MainMemoryBuffer ) ); + bufferParams.set( NUM_SAMPLES_INDEX, numSamplesTF.getText() ); + bufferParams.set( BASE_ADDRESS_INDEX, baseAddressTF.getText() ); + } + else { + bufferParams.add( BUFFER_TYPE_INDEX, String.valueOf( Buffer.MainMemoryBuffer ) ); + bufferParams.add( NUM_SAMPLES_INDEX, numSamplesTF.getText() ); + bufferParams.add( BASE_ADDRESS_INDEX, baseAddressTF.getText() ); + } + } + + public static ArrayList<String> getBufferParameters() { + return bufferParams; + } + } //End of class diff --git a/src/tmltranslator/ctranslator/MapperBuffer.java b/src/tmltranslator/ctranslator/MapperBuffer.java index 52755b668ed46c612333deac56b210b44cc01537..2bb1e82636315bf22224852b870487e2fb4ed953 100644 --- a/src/tmltranslator/ctranslator/MapperBuffer.java +++ b/src/tmltranslator/ctranslator/MapperBuffer.java @@ -87,7 +87,9 @@ public class MapperBuffer extends Buffer { protected String baseAddressLUTValue = USER_TO_DO; public static final String BASE_ADDRESS_LUT_TYPE = "uint16_t"; - private static final int MAX_PARAMETERS = 6;; + private static ArrayList<String> bufferParams;// = new ArrayList<String>(); //the DS that collects all the above params + + private static final int MAX_PARAMETERS = 6; //PANEL //Mapper Data In @@ -189,14 +191,14 @@ public class MapperBuffer extends Buffer { } else { //data in - sb.append("\" numSamplesDataIn=\"" + SP ); - sb.append("\" baseAddressDataIn=\"" + SP ); - sb.append("\" bitsPerSymbolDataIn=\"" + SP ); - sb.append("\" symmetricalValueDataIn=\"" + SP ); + sb.append("\" numSamplesDataIn=\"\"" + SP ); + sb.append("baseAddressDataIn=\"\"" + SP ); + sb.append("bitsPerSymbolDataIn=\"\"" + SP ); + sb.append("symmetricalValueDataIn=\"\"" + SP ); //data out - sb.append("\" baseAddressDataOut=\"" + SP ); + sb.append("baseAddressDataOut=\"\"" + SP ); //Look-up Table - sb.append("\" baseAddressLUT=\"" + SP ); + sb.append("baseAddressLUT=\"" ); } return sb.toString(); } @@ -216,7 +218,7 @@ public class MapperBuffer extends Buffer { return buffer; } - public static ArrayList<JPanel> makePanel( boolean loadBufferParameters, GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { + public static ArrayList<JPanel> makePanel( GridBagConstraints c1, GridBagConstraints c2, ArrayList<String> bufferParameters ) { GridBagLayout gridbag2 = new GridBagLayout(); @@ -235,17 +237,15 @@ public class MapperBuffer extends Buffer { panel5.setBorder(new javax.swing.border.TitledBorder("Code generation: Look Up Table configuration")); panel5.setPreferredSize(new Dimension(650, 350)); - if( loadBufferParameters ) { - //data in - numSamplesDataIn = bufferParameters.get( NUM_SAMPLES_DATAIN_INDEX ); - baseAddressDataIn = bufferParameters.get( BASE_ADDRESS_DATAIN_INDEX ); - bitsPerSymbolDataIn = bufferParameters.get( BITS_PER_SYMBOL_DATAIN_INDEX ); - symmetricalValueDataIn = bufferParameters.get( SYMMETRICAL_VALUE_DATAIN_INDEX ); - //data out - baseAddressDataOut = bufferParameters.get( BASE_ADDRESS_DATAOUT_INDEX ); - //look-up table - baseAddressLUT = bufferParameters.get( BASE_ADDRESS_LUT_INDEX ); - } + //data in + numSamplesDataIn = bufferParameters.get( NUM_SAMPLES_DATAIN_INDEX ); + baseAddressDataIn = bufferParameters.get( BASE_ADDRESS_DATAIN_INDEX ); + bitsPerSymbolDataIn = bufferParameters.get( BITS_PER_SYMBOL_DATAIN_INDEX ); + symmetricalValueDataIn = bufferParameters.get( SYMMETRICAL_VALUE_DATAIN_INDEX ); + //data out + baseAddressDataOut = bufferParameters.get( BASE_ADDRESS_DATAOUT_INDEX ); + //look-up table + baseAddressLUT = bufferParameters.get( BASE_ADDRESS_LUT_INDEX ); //Data In panel c2.anchor = GridBagConstraints.LINE_START; @@ -289,6 +289,7 @@ public class MapperBuffer extends Buffer { panelsList.add(panel4); panelsList.add(panel5); + fillBufferParameters(); //to avoid an empty buffer of parameters if user closes the window without saving return panelsList; } @@ -302,7 +303,7 @@ public class MapperBuffer extends Buffer { String regex = "[0-9]+"; if( baseAddressDataIn.length() <= 2 && baseAddressDataIn.length() > 0 ) { - JOptionPane.showMessageDialog( frame, "Please enter a valid base address", "Badly formatted parameter", + JOptionPane.showMessageDialog( frame, "Please enter a valid base address for the input buffer", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; } @@ -313,27 +314,25 @@ public class MapperBuffer extends Buffer { return false; } } - /*if( !( numSamplesDataIn.length() > 0 ) ) { - return true; - }*/ - if( !numSamplesDataIn.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The number of bits/symbol must be expressed as a natural", "Badly formatted parameter", + if( numSamplesDataIn.length() > 0 ) { + if( !numSamplesDataIn.matches( regex ) ) { + JOptionPane.showMessageDialog( frame, "The number of bits/symbol must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( !( bitsPerSymbolDataIn.length() > 0 ) ) { - return true; + return false; + } } - if( !bitsPerSymbolDataIn.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The number of bits/symbol must be expressed as a natural", "Badly formatted parameter", + if( bitsPerSymbolDataIn.length() > 0 ) { + if( !bitsPerSymbolDataIn.matches( regex ) ) { + JOptionPane.showMessageDialog( frame, "The number of bits/symbol must be expressed as a natural", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); - return false; + return false; + } } //check DO baseAddressDataOut = (String)baseAddressDataOut_TF.getText(); if( baseAddressDataOut.length() <= 2 && baseAddressDataOut.length() > 0 ) { - JOptionPane.showMessageDialog( frame, "Please enter a valid base address", "Badly formatted parameter", + JOptionPane.showMessageDialog( frame, "Please enter a valid base address for the output buffer", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; } @@ -348,7 +347,7 @@ public class MapperBuffer extends Buffer { //check LUT table baseAddressLUT = (String) baseAddressLUT_TF.getText(); if( baseAddressLUT.length() <= 2 && baseAddressLUT.length() > 0 ) { - JOptionPane.showMessageDialog( frame, "Please enter a valid base address", "Badly formatted parameter", + JOptionPane.showMessageDialog( frame, "Please enter a valid LUT base address", "Badly formatted parameter", JOptionPane.INFORMATION_MESSAGE ); return false; } @@ -359,21 +358,44 @@ public class MapperBuffer extends Buffer { return false; } } - + + fillBufferParameters(); return true; } - public static void getBufferParameters( ArrayList<String> params ) { + private static void fillBufferParameters() { - //data in - params.add( NUM_SAMPLES_DATAIN_INDEX, numSamplesDataIn ); - params.add( BASE_ADDRESS_DATAIN_INDEX, baseAddressDataIn ); - params.add( BITS_PER_SYMBOL_DATAIN_INDEX, bitsPerSymbolDataIn ); - params.add( SYMMETRICAL_VALUE_DATAIN_INDEX, symmetricalValueDataIn ); - //data out - params.add( BASE_ADDRESS_DATAOUT_INDEX, baseAddressDataOut ); - //look-up table - params.add( BASE_ADDRESS_LUT_INDEX, baseAddressLUT ); + if( bufferParams == null ) { + bufferParams = new ArrayList<String>(); + } + if( bufferParams.size() > 0 ) { + bufferParams.set( BUFFER_TYPE_INDEX, String.valueOf( Buffer.MapperBuffer ) ); + //data in + bufferParams.set( NUM_SAMPLES_DATAIN_INDEX, numSamplesDataIn ); + bufferParams.set( BASE_ADDRESS_DATAIN_INDEX, baseAddressDataIn ); + bufferParams.set( BITS_PER_SYMBOL_DATAIN_INDEX, bitsPerSymbolDataIn ); + bufferParams.set( SYMMETRICAL_VALUE_DATAIN_INDEX, symmetricalValueDataIn ); + //data out + bufferParams.set( BASE_ADDRESS_DATAOUT_INDEX, baseAddressDataOut ); + //look-up table + bufferParams.set( BASE_ADDRESS_LUT_INDEX, baseAddressLUT ); + } + else { + bufferParams.add( BUFFER_TYPE_INDEX, String.valueOf( Buffer.MapperBuffer ) ); + //data in + bufferParams.add( NUM_SAMPLES_DATAIN_INDEX, numSamplesDataIn ); + bufferParams.add( BASE_ADDRESS_DATAIN_INDEX, baseAddressDataIn ); + bufferParams.add( BITS_PER_SYMBOL_DATAIN_INDEX, bitsPerSymbolDataIn ); + bufferParams.add( SYMMETRICAL_VALUE_DATAIN_INDEX, symmetricalValueDataIn ); + //data out + bufferParams.add( BASE_ADDRESS_DATAOUT_INDEX, baseAddressDataOut ); + //look-up table + bufferParams.add( BASE_ADDRESS_LUT_INDEX, baseAddressLUT ); + } + } + + public static ArrayList<String> getBufferParameters() { + return bufferParams; } } //End of class diff --git a/src/ui/tmldd/TMLArchiCPNode.java b/src/ui/tmldd/TMLArchiCPNode.java index f24fafe3104f3af99e406ed5307ebd1f4abe3db7..345c845e6f328a578554f2039f8359a65f053e68 100755 --- a/src/ui/tmldd/TMLArchiCPNode.java +++ b/src/ui/tmldd/TMLArchiCPNode.java @@ -211,6 +211,7 @@ public class TMLArchiCPNode extends TMLArchiCommunicationNode implements Swallow transferType1 = dialog.getTransferTypes().get(0); transferType2 = dialog.getTransferTypes().get(1); assignedAttributes = dialog.getAssignedAttributes(); + TraceManager.addDev( "RETRIEVING ASSIGNED ATTRIBUTES: " + assignedAttributes.toString() ); if( !dialog.isRegularClose() ) { return false; diff --git a/src/ui/tmldd/TMLArchiPortArtifact.java b/src/ui/tmldd/TMLArchiPortArtifact.java index 8908d07a897f21bccde81dfe6cf0a9f3bd45b3e3..a9892e467e8db93d2220ef16e075a73c4ca03074 100644 --- a/src/ui/tmldd/TMLArchiPortArtifact.java +++ b/src/ui/tmldd/TMLArchiPortArtifact.java @@ -148,9 +148,7 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements while(iterator.hasNext()) { tgc = (TGComponent)(iterator.next()); if (tgc instanceof TMLArchiMemoryNode) { - //TraceManager.addDev("Testing |" + tgc.getName() + "| vs | " + s + "|"); if (tgc.getName().compareTo(mappedMemory) == 0) { - //TraceManager.addDev("Ok"); GraphicLib.dashedLine(g, getX() + getWidth()/2, getY() + getHeight()/2, tgc.getX() + tgc.getWidth()/2, tgc.getY() + tgc.getHeight()/2); } } @@ -189,14 +187,14 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements String tmp; boolean error = false; - TraceManager.addDev( "bufferParameters before: " + bufferParameters.toString() ); + TraceManager.addDev( "bufferParameters before opening the window: " + bufferParameters.toString() ); JDialogPortArtifact dialog = new JDialogPortArtifact(frame, "Setting port artifact attributes", this, mappedMemory, bufferParameters, value ); dialog.setSize(700, 600); GraphicLib.centerOnParent(dialog); dialog.show(); // blocked until dialog has been closed mappedMemory = dialog.getMappedMemory(); - bufferParameters = dialog.getBufferParameters(); - TraceManager.addDev( "bufferParameters after: " + bufferParameters.toString() ); + bufferParameters = dialog.getBufferParameters(); //becomes empty if closing the window without pushing Save + TraceManager.addDev( "bufferParameters after closing the window: " + bufferParameters.toString() ); bufferType = bufferParameters.get( Buffer.bufferTypeIndex ); if (!dialog.isRegularClose()) { diff --git a/src/ui/window/JDialogPortArtifact.java b/src/ui/window/JDialogPortArtifact.java index 402182224a0941f44c1def4d07ace38acf24ed77..c0f4cd1c7c47d873cd3624d7810340e76e2dca79 100755 --- a/src/ui/window/JDialogPortArtifact.java +++ b/src/ui/window/JDialogPortArtifact.java @@ -107,32 +107,33 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi private JPanel panel3, panel4, panel5; private JTabbedPane tabbedPane; private int bufferType = 0; - private boolean loadBufferParameters = false; private ArrayList<String> bufferParameters; + private String appName = ""; /** Creates new form */ public JDialogPortArtifact(Frame _frame, String _title, TMLArchiPortArtifact _artifact, String _mappedMemory, ArrayList<String> _bufferParameters, String _mappedPort ) { - super(_frame, _title, true); - frame = _frame; - artifact = _artifact; - mappedMemory = _mappedMemory; - bufferParameters = _bufferParameters; - mappedPort = _mappedPort; - - TraceManager.addDev("init components"); - - initComponents(); - - TraceManager.addDev("my init components"); - - myInitComponents(); - - TraceManager.addDev("pack"); - pack(); + super(_frame, _title, true); + frame = _frame; + artifact = _artifact; + mappedMemory = _mappedMemory; + bufferParameters = _bufferParameters; + mappedPort = _mappedPort; + appName = mappedPort.split("::")[0]; + + TraceManager.addDev("init components"); + + initComponents(); + + TraceManager.addDev("my init components"); + + myInitComponents(); + + TraceManager.addDev("pack"); + pack(); } private void myInitComponents() { - selectPriority(); + selectPriority(); } private void initComponents() { @@ -172,6 +173,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi c1.gridwidth = GridBagConstraints.REMAINDER; //end row TraceManager.addDev("Getting communications"); Vector<String> list = artifact.getTDiagramPanel().getMGUI().getAllTMLCommunicationNames(); + Vector<String> portsList = new Vector<String>(); int index = 0; if (list.size() == 0) { @@ -182,23 +184,24 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi index = 0;//indexOf(list, artifact.getFullValue()); //parse each entry of list. Entry is in format AppName::chIn__chOut for( String s: list ) { - TraceManager.addDev( "Parsing: " + s ); - String[] temp1 = s.split("__"); - String[] temp2 = temp1[0].split( "::" ); - String chOut = temp2[0] + "::" + temp1[1]; - String chIn = temp2[0] + "::" + temp2[1]; - if( !portsList.contains( chOut ) ) { - portsList.add( chOut ); - } - if( !portsList.contains( chIn ) ) { - portsList.add( chIn ); + if( s.contains( appName ) ) { //build the DS for the mapped applications (filter out the case of multiple applications) + TraceManager.addDev( "Parsing: " + s ); + String[] temp1 = s.split("__"); + String[] temp2 = temp1[0].split( "::" ); + String chOut = temp2[0] + "::" + temp1[1]; + String chIn = temp2[0] + "::" + temp2[1]; + if( !portsList.contains( chOut ) ) { + portsList.add( chOut ); + } + if( !portsList.contains( chIn ) ) { + portsList.add( chIn ); + } } } } TraceManager.addDev("Got communications"); - referenceCommunicationName = new JComboBox(portsList); if( mappedPort.equals( "VOID" ) || mappedPort.equals( "" ) ) { referenceCommunicationName.setSelectedIndex( 0 ); @@ -238,47 +241,46 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi memoryCB.addActionListener(this); panel2.add( memoryCB, c1 ); - if( bufferParameters.size() == 0 ) { + /*if( bufferParameters.size() == 0 ) { bufferType = getBufferTypeFromSelectedMemory( (String)memoryCB.getItemAt( memoryCB.getSelectedIndex() ) ); - loadBufferParameters = false; + TraceManager.addDev( "From if branch, the buffer type is: " + bufferType ); } - else { + else {*/ bufferType = Integer.parseInt( bufferParameters.get( Buffer.bufferTypeIndex ) ); - loadBufferParameters = true; - } + //} ArrayList<JPanel> panelsList; switch( bufferType ) { case Buffer.FepBuffer: - panelsList = FepBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = FepBuffer.makePanel( c1, c2, bufferParameters ); panel3 = panelsList.get(0); break; case Buffer.InterleaverBuffer: - panelsList = InterleaverBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = InterleaverBuffer.makePanel( c1, c2, bufferParameters ); tabbedPane.addTab( "Data In", panelsList.get(0) ); tabbedPane.addTab( "Data Out", panelsList.get(1) ); tabbedPane.addTab( "Permutation Table", panelsList.get(2) ); tabbedPane.setSelectedIndex(0); break; case Buffer.AdaifBuffer: - panelsList = AdaifBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = AdaifBuffer.makePanel( c1, c2, bufferParameters ); panel3 = panelsList.get(0); break; case Buffer.MapperBuffer: tabbedPane.removeAll(); - panelsList = MapperBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = MapperBuffer.makePanel( c1, c2, bufferParameters ); tabbedPane.addTab( "Data In", panelsList.get(0) ); tabbedPane.addTab( "Data Out", panelsList.get(1) ); tabbedPane.addTab( "Look Up Table", panelsList.get(2) ); tabbedPane.setSelectedIndex(0); break; case Buffer.MainMemoryBuffer: - panelsList = MMBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = MMBuffer.makePanel( c1, c2, bufferParameters ); panel3 = panelsList.get(0); break; default: //the fep buffer - panelsList = FepBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = FepBuffer.makePanel( c1, c2, bufferParameters ); panel3 = panelsList.get(0); break; } @@ -311,242 +313,39 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi c.add(cancelButton, c0); } - /*private void makeFepBufferPanel( GridBagConstraints c1, GridBagConstraints c2 ) { - - panel3.setBorder(new javax.swing.border.TitledBorder("Code generation: memory configuration")); - - c2.anchor = GridBagConstraints.LINE_START; - numSamplesTF = new JTextField( numSamples, 5 ); - panel3.add( new JLabel( "Number of samples = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel3.add( numSamplesTF, c1 ); - // - baseAddressTF = new JTextField( baseAddress, 5 ); - panel3.add( new JLabel( "Base address = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel3.add( baseAddressTF, c1 ); - // - bankCB = new JComboBox( new Vector<String>( Arrays.asList( FepBuffer.banksList ) ) ); - panel3.add( new JLabel( "Bank number = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - if( bank != null ) { - bankCB.setSelectedIndex( Integer.parseInt( bank ) ); - } - panel3.add( bankCB, c1 ); - // - dataTypeCB = new JComboBox( new Vector<String>( Arrays.asList( FepBuffer.dataTypeList ) ) ); - panel3.add( new JLabel( "Data type = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - if( dataType != null ) { - dataTypeCB.setSelectedItem( dataType ); - } - panel3.add( dataTypeCB, c1 ); - }*/ - - /*private void makeInterleaverBufferPanel( GridBagConstraints c1, GridBagConstraints c2 ) { - - GridBagLayout gridbag2 = new GridBagLayout(); - - panel3 = new JPanel(); //data in - panel3.setLayout(gridbag2); - panel3.setBorder(new javax.swing.border.TitledBorder("Code generation: input buffer configuration")); - panel3.setPreferredSize(new Dimension(650, 350)); - - panel4 = new JPanel(); //data out - panel4.setLayout(gridbag2); - panel4.setBorder(new javax.swing.border.TitledBorder("Code generation: output buffer configuration")); - panel4.setPreferredSize(new Dimension(650, 350)); - - panel5 = new JPanel(); //permutation table - panel5.setLayout(gridbag2); - panel5.setBorder(new javax.swing.border.TitledBorder("Code generation: Permutation Table configuration")); - panel5.setPreferredSize(new Dimension(650, 350)); - - //Data In panel - c2.anchor = GridBagConstraints.LINE_START; - packedBinaryInIntl_CB = new JComboBox( Buffer.onOffVector ); - panel3.add( new JLabel( "Packed binary input mode = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - if( packedBinaryInIntl != null ) { - packedBinaryInIntl_CB.setSelectedItem( packedBinaryInIntl ); - } - panel3.add( packedBinaryInIntl_CB, c1 ); - // - widthIntl_TF = new JTextField( widthIntl, 5 ); - panel3.add( new JLabel( "Sample width = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel3.add( widthIntl_TF, c1 ); - // - bitInOffsetIntl_TF = new JTextField( bitInOffsetIntl, 5 ); - panel3.add( new JLabel( "Bit input offset = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel3.add( bitInOffsetIntl_TF, c1 ); - // - inputOffsetIntl_TF = new JTextField( inputOffsetIntl, 5 ); - panel3.add( new JLabel( "Offset of first input sample = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel3.add( inputOffsetIntl_TF, c1 ); - // - - //Data Out panel - c2.anchor = GridBagConstraints.LINE_START; - packedBinaryOutIntl_CB = new JComboBox( Buffer.onOffVector ); - panel4.add( new JLabel( "Packed binary output mode = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - if( packedBinaryOutIntl != null ) { - packedBinaryOutIntl_CB.setSelectedItem( packedBinaryOutIntl ); - } - panel4.add( packedBinaryOutIntl_CB, c1 ); - // - bitOutOffsetIntl_TF = new JTextField( bitOutOffsetIntl, 5 ); - panel4.add( new JLabel( "Bit output offset = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel4.add( bitOutOffsetIntl_TF, c1 ); - // - c2.anchor = GridBagConstraints.LINE_START; - outputOffsetIntl_TF = new JTextField( outputOffsetIntl, 5 ); - panel4.add( new JLabel( "Offset of first output sample = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel4.add( outputOffsetIntl_TF, c1 ); - - //Permutation Table panel - c2.anchor = GridBagConstraints.LINE_START; - offsetPermIntl_TF = new JTextField( offsetPermIntl, 5 ); - panel5.add( new JLabel( "Offset = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel5.add( offsetPermIntl_TF, c1 ); - // - c2.anchor = GridBagConstraints.LINE_START; - lengthPermIntl_TF = new JTextField( lengthPermIntl, 5 ); - panel5.add( new JLabel( "Length = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel5.add( lengthPermIntl_TF, c1 ); - - tabbedPane.addTab( "Data In", panel3 ); - tabbedPane.addTab( "Data Out", panel4 ); - tabbedPane.addTab( "Permutation Table", panel5 ); - tabbedPane.setSelectedIndex(0); - }*/ - - /*private void makeAdaifBufferPanel( GridBagConstraints c1, GridBagConstraints c2 ) { - c2.anchor = GridBagConstraints.LINE_START; - makeMainMemoryBufferPanel( c1, c2 ); - }*/ - - /*private void makeMapperBufferPanel( GridBagConstraints c1, GridBagConstraints c2 ) { - - GridBagLayout gridbag2 = new GridBagLayout(); - - panel3 = new JPanel(); - panel3.setLayout(gridbag2); - panel3.setBorder(new javax.swing.border.TitledBorder("Code generation: input buffer configuration")); - panel3.setPreferredSize(new Dimension(650, 350)); - - panel4 = new JPanel(); - panel4.setLayout(gridbag2); - panel4.setBorder(new javax.swing.border.TitledBorder("Code generation: output buffer configuration")); - panel4.setPreferredSize(new Dimension(650, 350)); - - panel5 = new JPanel(); - panel5.setLayout(gridbag2); - panel5.setBorder(new javax.swing.border.TitledBorder("Code generation: Look Up Table configuration")); - panel5.setPreferredSize(new Dimension(650, 350)); + private int getBufferTypeFromSelectedMemory( String mappedMemory ) { - //Data In panel - c2.anchor = GridBagConstraints.LINE_START; - numSamplesDataInMapp_TF = new JTextField( numSamplesDataInMapp, 5 ); - panel3.add( new JLabel( "Number of symbols = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel3.add( numSamplesDataInMapp_TF, c1 ); - // - baseAddressDataInMapp_TF = new JTextField( baseAddressDataInMapp, 5 ); - panel3.add( new JLabel( "Base address = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel3.add( baseAddressDataInMapp_TF, c1 ); - // - bitsPerSymbolDataInMapp_TF = new JTextField( bitsPerSymbolDataInMapp, 5 ); - panel3.add( new JLabel( "Number of bits/symbol = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel3.add( bitsPerSymbolDataInMapp_TF, c1 ); - // - symmetricalValueDataInMapp_CB = new JComboBox( new Vector<String>( Arrays.asList( MapperBuffer.symmetricalValues ) ) ); - panel3.add( new JLabel( "Symmetrical value = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - if( symmetricalValueDataInMapp != null ) { - symmetricalValueDataInMapp_CB.setSelectedItem( symmetricalValueDataInMapp ); - } - panel3.add( symmetricalValueDataInMapp_CB, c1 ); - - //Data Out panel - baseAddressDataOutMapp_TF = new JTextField( baseAddressDataOutMapp, 5 ); - panel4.add( new JLabel( "Base address = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel4.add( baseAddressDataOutMapp_TF, c1 ); - // - //Look Up Table panel - baseAddressLUTMapp_TF = new JTextField( baseAddressLUTMapp, 5 ); - panel5.add( new JLabel( "Base address = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - panel5.add( baseAddressLUTMapp_TF, c1 ); - // - - tabbedPane.addTab( "Data In", panel3 ); - tabbedPane.addTab( "Data Out", panel4 ); - tabbedPane.addTab( "Look Up Table", panel5 ); - tabbedPane.setSelectedIndex(0); - }*/ - - private void makeMainMemoryBufferPanel( GridBagConstraints c1, GridBagConstraints c2 ) { + LinkedList componentList = artifact.getTDiagramPanel().getComponentList(); + Vector<String> list = new Vector<String>(); - panel3.setBorder(new javax.swing.border.TitledBorder("Code generation: memory configuration")); - - c2.anchor = GridBagConstraints.LINE_START; - numSamplesTF = new JTextField( numSamples, 5 ); - panel3.add( new JLabel( "Number of samples = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - numSamplesTF = new JTextField( numSamples, 5 ); - panel3.add( numSamplesTF, c1 ); - // - baseAddressTF = new JTextField( baseAddress, 5 ); - panel3.add( new JLabel( "Base address = "), c2 ); - c1.gridwidth = GridBagConstraints.REMAINDER; - baseAddressTF = new JTextField( baseAddress, 5 ); - panel3.add( baseAddressTF, c1 ); - } - - private int getBufferTypeFromSelectedMemory( String mappedMemory ) { - - LinkedList componentList = artifact.getTDiagramPanel().getComponentList(); - Vector<String> list = new Vector<String>(); - - for( int k = 0; k < componentList.size(); k++ ) { - if( componentList.get(k) instanceof TMLArchiMemoryNode ) { - TMLArchiMemoryNode memoryNode = (TMLArchiMemoryNode)componentList.get(k); - if( memoryNode.getName().equals( mappedMemory ) ) { - return memoryNode.getBufferType(); - } + for( int k = 0; k < componentList.size(); k++ ) { + if( componentList.get(k) instanceof TMLArchiMemoryNode ) { + TMLArchiMemoryNode memoryNode = (TMLArchiMemoryNode)componentList.get(k); + if( memoryNode.getName().equals( mappedMemory ) ) { + return memoryNode.getBufferType(); } } - return 0; //default: the main memory buffer } + return 0; //default: the main memory buffer + } - public void actionPerformed(ActionEvent evt) { + public void actionPerformed(ActionEvent evt) { - if (evt.getSource() == referenceCommunicationName) { - selectPriority(); - } - if( evt.getSource() == memoryCB ) { - updateBufferPanel(); - } + if (evt.getSource() == referenceCommunicationName) { + selectPriority(); + } + if( evt.getSource() == memoryCB ) { + updateBufferPanel(); + } - String command = evt.getActionCommand(); - // Compare the action command to the known actions. - if (command.equals("Save and Close")) { - closeDialog(); - } else if (command.equals("Cancel")) { - cancelDialog(); - } - } + String command = evt.getActionCommand(); + // Compare the action command to the known actions. + if (command.equals("Save and Close")) { + closeDialog(); + } else if (command.equals("Cancel")) { + cancelDialog(); + } + } private void updateBufferPanel() { @@ -562,19 +361,18 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi //flushBuffersStrings(); bufferType = getBufferTypeFromSelectedMemory( (String)memoryCB.getItemAt( memoryCB.getSelectedIndex() ) ); - loadBufferParameters = false; //previous information will be lost ArrayList<JPanel> panelsList; switch( bufferType ) { case Buffer.FepBuffer: tabbedPane.removeAll(); - panelsList = FepBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = FepBuffer.makePanel( c1, c2, bufferParameters ); panel3 = panelsList.get(0); tabbedPane.addTab( "Data", panel3 ); break; case Buffer.MapperBuffer: tabbedPane.removeAll(); - panelsList = MapperBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = MapperBuffer.makePanel( c1, c2, bufferParameters ); tabbedPane.addTab( "Data In", panelsList.get(0) ); tabbedPane.addTab( "Data Out", panelsList.get(1) ); tabbedPane.addTab( "Look Up Table", panelsList.get(2) ); @@ -582,13 +380,13 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi break; case Buffer.AdaifBuffer: tabbedPane.removeAll(); - panelsList = AdaifBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = AdaifBuffer.makePanel( c1, c2, bufferParameters ); panel3 = panelsList.get(0); tabbedPane.addTab( "Data", panel3 ); break; case Buffer.InterleaverBuffer: tabbedPane.removeAll(); - panelsList = InterleaverBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = InterleaverBuffer.makePanel( c1, c2, bufferParameters ); tabbedPane.addTab( "Data In", panelsList.get(0) ); tabbedPane.addTab( "Data Out", panelsList.get(1) ); tabbedPane.addTab( "Permutation Table", panelsList.get(2) ); @@ -596,50 +394,19 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi break; case Buffer.MainMemoryBuffer: tabbedPane.removeAll(); - panelsList = MMBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = MMBuffer.makePanel( c1, c2, bufferParameters ); panel3 = panelsList.get(0); tabbedPane.addTab( "Data", panel3 ); break; default: //the main memory buffer tabbedPane.removeAll(); - panelsList = FepBuffer.makePanel( loadBufferParameters, c1, c2, bufferParameters ); + panelsList = FepBuffer.makePanel( c1, c2, bufferParameters ); panel3 = panelsList.get(0); tabbedPane.addTab( "Data", panel3 ); break; } } - /*private void flushBuffersStrings() { - - //interleaver - widthIntl = ""; - bitInOffsetIntl = ""; - inputOffsetIntl = ""; - packedBinaryInIntl = ""; - packedBinaryOutIntl = ""; - bitOutOffsetIntl = ""; - outputOffsetIntl = ""; - lengthPermIntl = ""; - offsetPermIntl = ""; - - //mapper - baseAddressDataInMapp = ""; - numSamplesDataInMapp = ""; - bitsPerSymbolDataInMapp = ""; - symmetricalValueDataInMapp = ""; - baseAddressDataOutMapp = ""; - baseAddressLUTMapp = ""; - - //other buffers - baseAddress = ""; - mappedPort = ""; - sampleLength = ""; - numSamples = ""; - bitsPerSymbol = ""; - symmetricalValue = ""; - }*/ - - public void selectPriority() { //System.out.println("Select priority"); int index = ((TMLArchiDiagramPanel)artifact.getTDiagramPanel()).getMaxPriority((String)(referenceCommunicationName.getSelectedItem())); @@ -652,7 +419,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi mappedMemory = (String) memoryCB.getItemAt( memoryCB.getSelectedIndex() ); bufferType = getBufferTypeFromSelectedMemory( (String)memoryCB.getItemAt( memoryCB.getSelectedIndex() ) ); switch ( bufferType ) { - case Buffer.FepBuffer: + case Buffer.FepBuffer: if( !FepBuffer.closePanel( frame ) ) { return; } @@ -743,7 +510,6 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi return ""; } - public int indexOf(Vector<String> _list, String name) { int i = 0; for(String s : _list) { @@ -759,256 +525,28 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi return priority.getSelectedIndex(); } - /*private boolean checkBaseAddress() { - - baseAddress = (String) baseAddressTF.getText(); - if( baseAddress.length() <= 2 && baseAddress.length() > 0 ) { - JOptionPane.showMessageDialog( frame, "Please enter a valid base address", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( baseAddress.length() > 2 ) { - if( !( baseAddress.substring(0,2).equals("0x") || baseAddress.substring(0,2).equals("0X") ) ) { - JOptionPane.showMessageDialog( frame, "Base address must be expressed in hexadecimal", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - } - return true; - }*/ - - /*private boolean checkLUT_Mapper() { - - baseAddressLUTMapp = (String) baseAddressLUTMapp_TF.getText(); - if( baseAddressLUTMapp.length() <= 2 && baseAddressLUTMapp.length() > 0 ) { - JOptionPane.showMessageDialog( frame, "Please enter a valid base address", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( baseAddressLUTMapp.length() > 2 ) { - if( !( baseAddressLUTMapp.substring(0,2).equals("0x") || baseAddressLUTMapp.substring(0,2).equals("0X") ) ) { - JOptionPane.showMessageDialog( frame, "Base address must be expressed in hexadecimal", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - } - return true; - }*/ - - /*private boolean checkDI_Mapper() { - - numSamplesDataInMapp = (String)numSamplesDataInMapp_TF.getText(); - baseAddressDataInMapp = (String)baseAddressDataInMapp_TF.getText(); - bitsPerSymbolDataInMapp = (String)bitsPerSymbolDataInMapp_TF.getText(); - symmetricalValueDataInMapp = (String)symmetricalValueDataInMapp_CB.getSelectedItem(); - String regex = "[0-9]+"; - - if( baseAddressDataInMapp.length() <= 2 && baseAddressDataInMapp.length() > 0 ) { - JOptionPane.showMessageDialog( frame, "Please enter a valid base address", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( baseAddressDataInMapp.length() > 2 ) { - if( !( baseAddressDataInMapp.substring(0,2).equals("0x") || baseAddressDataInMapp.substring(0,2).equals("0X") ) ) { - JOptionPane.showMessageDialog( frame, "Base address must be expressed in hexadecimal", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - } - if( !( numSamplesDataInMapp.length() > 0 ) ) { - return true; - } - if( !numSamplesDataInMapp.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The number of bits/symbol must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( !( bitsPerSymbolDataInMapp.length() > 0 ) ) { - return true; - } - if( !bitsPerSymbolDataInMapp.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The number of bits/symbol must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - return true; - }*/ - - /*private boolean checkDO_Mapper() { - - baseAddressDataOutMapp = (String)baseAddressDataOutMapp_TF.getText(); - if( baseAddressDataOutMapp.length() <= 2 && baseAddressDataOutMapp.length() > 0 ) { - JOptionPane.showMessageDialog( frame, "Please enter a valid base address", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( baseAddressDataOutMapp.length() > 2 ) { - if( !( baseAddressDataOutMapp.substring(0,2).equals("0x") || baseAddressDataOutMapp.substring(0,2).equals("0X") ) ) { - JOptionPane.showMessageDialog( frame, "Base address must be expressed in hexadecimal", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - } - return true; - }*/ - - /*private boolean checkDI_Intl() { - - String regex = "[0-9]+"; - widthIntl = (String)widthIntl_TF.getText(); - bitInOffsetIntl = (String)bitInOffsetIntl_TF.getText(); - inputOffsetIntl = (String)inputOffsetIntl_TF.getText(); - packedBinaryInIntl = (String)packedBinaryInIntl_CB.getSelectedItem(); - - if( !( widthIntl.length() > 0 ) ) { - return true; - } - if( !widthIntl.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The samples width must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( !( bitInOffsetIntl.length() > 0 ) ) { - return true; - } - if( !bitInOffsetIntl.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The bit input offset must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( !( inputOffsetIntl.length() > 0 ) ) { - return true; - } - if( !inputOffsetIntl.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The bit intput offset must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - return true; - }*/ - -/* private boolean checkDO_Intl() { - - //check bitOutOffset and outOffset - packedBinaryOutIntl = (String)packedBinaryOutIntl_CB.getSelectedItem(); - bitOutOffsetIntl = (String)bitOutOffsetIntl_TF.getText(); - outputOffsetIntl = (String)outputOffsetIntl_TF.getText(); - String regex = "[0-9]+"; - - if( !( bitOutOffsetIntl.length() > 0 ) ) { - return true; - } - if( !bitOutOffsetIntl.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The bit output offset must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - // check output offset - if( !( outputOffsetIntl.length() > 0 ) ) { - return true; - } - if( !outputOffsetIntl.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The output offset must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - return true; - }*/ - - /*private boolean CheckPerm_Intl() { - - String regex = "[0-9]+"; - offsetPermIntl = (String) offsetPermIntl_TF.getText(); - lengthPermIntl = (String) lengthPermIntl_TF.getText(); - //check first entry offset - if( !( offsetPermIntl.length() > 0 ) ) { - return true; - } - if( !offsetPermIntl.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The offset must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - //check permutation table length - if( !( lengthPermIntl.length() > 0 ) ) { - return true; - } - if( !lengthPermIntl.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The length must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( Integer.parseInt( lengthPermIntl ) == 0 ) { - JOptionPane.showMessageDialog( frame, "The length must be greater than 0", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - return true; - }*/ - - /*private boolean checkNumSamples() { - - String regex = "[0-9]+"; - numSamples = (String) numSamplesTF.getText(); - if( !( numSamples.length() > 0 ) ) { - return true; - } - if( !numSamples.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The number of samples must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( Integer.parseInt( numSamples ) == 0 ) { - JOptionPane.showMessageDialog( frame, "The number of samples must be greater than 0", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - return true; - }*/ - - - /*private boolean checkNumBitsPerSymbol() { - - String regex = "[0-9]+"; - bitsPerSymbol = (String) bitsPerSymbolTF.getText(); - if( !( bitsPerSymbol.length() > 0 ) ) { - return true; - } - if( Integer.parseInt( bitsPerSymbol ) == 0 ) { - JOptionPane.showMessageDialog( frame, "The number of bits/samples must be greater than 0", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - if( !bitsPerSymbol.matches( regex ) ) { - JOptionPane.showMessageDialog( frame, "The number of bits/samples must be expressed as a natural", "Badly formatted parameter", - JOptionPane.INFORMATION_MESSAGE ); - return false; - } - return true; - }*/ - public ArrayList<String> getBufferParameters() { ArrayList<String> params = new ArrayList<String>(); params.add( String.valueOf( bufferType ) ); switch( bufferType ) { case Buffer.FepBuffer: - FepBuffer.getBufferParameters( params ); + params = FepBuffer.getBufferParameters(); break; case Buffer.InterleaverBuffer: - InterleaverBuffer.getBufferParameters( params ); + params = InterleaverBuffer.getBufferParameters(); break; case Buffer.AdaifBuffer: - AdaifBuffer.getBufferParameters( params ); + params = AdaifBuffer.getBufferParameters(); break; case Buffer.MapperBuffer: - MapperBuffer.getBufferParameters( params ); + params = MapperBuffer.getBufferParameters(); break; case Buffer.MainMemoryBuffer: - MMBuffer.getBufferParameters( params ); + params = MMBuffer.getBufferParameters(); break; default: //the main memory buffer - FepBuffer.getBufferParameters( params ); + params = FepBuffer.getBufferParameters(); break; } return params; diff --git a/src/ui/window/JDialogReferenceCP.java b/src/ui/window/JDialogReferenceCP.java index 013659936e4d3065ec985d372d68c04475f1bbbb..6f6e88493a3633d124bc168f62e793bb6ecb816e 100644 --- a/src/ui/window/JDialogReferenceCP.java +++ b/src/ui/window/JDialogReferenceCP.java @@ -528,7 +528,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis c5.weightx = 1.0; c5.fill = GridBagConstraints.HORIZONTAL; c5.anchor = GridBagConstraints.LINE_START; - panel5.add( new JLabel( "DMA Transfer Type 1:" ), c5 ); + panel5.add( new JLabel( "Type of DMA transfer n.1:" ), c5 ); transferTypeCB1 = new JComboBox( new Vector<String>( Arrays.asList( CPMEC.transferTypes ) ) ); if( transferType1 == -1 ) { transferTypeCB1.setSelectedIndex( 0 ); @@ -548,7 +548,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis c5.weightx = 1.0; c5.fill = GridBagConstraints.HORIZONTAL; c5.anchor = GridBagConstraints.LINE_START; - panel5.add( new JLabel( "DMA Transfer Type 2:" ), c5 ); + panel5.add( new JLabel( "Type of DMA transfer n.2:" ), c5 ); transferTypeCB2 = new JComboBox( new Vector<String>( Arrays.asList( CPMEC.transferTypes ) ) ); if( transferType2 == -1 ) { transferTypeCB2.setSelectedIndex( 0 );