コード例 #1
0
 private ArrayList<String> GetXilinxUCFStrings(String direction, int StartId) {
   ArrayList<String> Contents = new ArrayList<String>();
   StringBuffer Temp = new StringBuffer();
   Integer start = 0;
   Integer end = NrOfPins;
   ArrayList<String> labels = null;
   if (MyType.equals(IOComponentTypes.PortIO)) {
     labels = PortIO.GetLabels(IOComponentTypes.GetNrOfFPGAPins(MyType));
   } else if (MyType.equals(IOComponentTypes.LocalBus)) {
     labels = ReptarLocalBus.GetLabels();
     if (direction.equals("in")) {
       end = IOComponentTypes.GetFPGAInputRequirement(MyType);
     } else if (direction.equals("out")) {
       // TODO: YSY
       Contents.add(
           "NET \"FPGA_LB_OUT_0\" LOC = \"R24\" | IOSTANDARD = LVCMOS18 ; # SP6_LB_WAIT3_o");
       Contents.add("NET \"FPGA_LB_OUT_1\" LOC = \"AB30\" | IOSTANDARD = LVCMOS18 ; # IRQ_o");
       return Contents;
       // start = IOComponentTypes.GetFPGAInputRequirement(MyType);
       // end = start +
       // IOComponentTypes.GetFPGAOutputRequirement(MyType);
     } else if (direction.equals("inout")) {
       start =
           IOComponentTypes.GetFPGAInputRequirement(MyType)
               + IOComponentTypes.GetFPGAOutputRequirement(MyType);
       end = start + IOComponentTypes.GetFPGAInOutRequirement(MyType);
     }
   } else if (MyType.equals(IOComponentTypes.DIPSwitch)) {
     labels = DipSwitch.GetLabels(IOComponentTypes.GetNrOfFPGAPins(MyType));
   } else if (MyType.equals(IOComponentTypes.SevenSegment)) {
     labels = SevenSegment.GetLabels();
   } else if (MyType.equals(IOComponentTypes.RGBLED)) {
     labels = RGBLed.GetLabels();
   }
   for (int i = start; i < end; i++) {
     Temp.setLength(0);
     Temp.append("LOC = \"" + MyPinLocations.get(i) + "\" ");
     if (MyPullBehavior != PullBehaviors.Unknown && MyPullBehavior != PullBehaviors.Float) {
       Temp.append("| " + PullBehaviors.getContraintedPullString(MyPullBehavior) + " ");
     }
     if (MyDriveStrength != DriveStrength.Unknown
         && MyDriveStrength != DriveStrength.DefaulStength) {
       Temp.append(
           "| DRIVE = " + DriveStrength.GetContraintedDriveStrength(MyDriveStrength) + " ");
     }
     if (MyIOStandard != IoStandards.Unknown && MyIOStandard != IoStandards.DefaulStandard) {
       Temp.append("| IOSTANDARD = " + IoStandards.GetConstraintedIoStandard(MyIOStandard) + " ");
     }
     Temp.append(";");
     if (labels != null) {
       Temp.append(" # " + labels.get(i));
     }
     String NetName = "";
     if (direction == "in") {
       NetName =
           HDLGeneratorFactory.FPGAInputPinName + "_" + Integer.toString(StartId + i - start);
     } else if (direction == "inout") {
       NetName =
           HDLGeneratorFactory.FPGAInOutPinName + "_" + Integer.toString(StartId + i - start);
     } else {
       NetName =
           HDLGeneratorFactory.FPGAOutputPinName + "_" + Integer.toString(StartId + i - start);
     }
     // String NetName = (InputPins) ?
     // HDLGeneratorFactory.FPGAInputPinName + "_" +
     // Integer.toString(StartId + i)
     // : HDLGeneratorFactory.FPGAOutputPinName + "_" +
     // Integer.toString(StartId + i);
     Contents.add("NET \"" + NetName + "\" " + Temp.toString());
   }
   return Contents;
 }
コード例 #2
0
  private void GetSimpleInformationDialog(BoardDialog parent) {
    int NrOfDevicePins = IOComponentTypes.GetNrOfFPGAPins(MyType);
    final JDialog selWindow = new JDialog(parent.GetPanel(), MyType + " properties");
    JComboBox<String> DriveInput = new JComboBox<>(DriveStrength.Behavior_strings);
    JComboBox<String> PullInput = new JComboBox<>(PullBehaviors.Behavior_strings);
    JComboBox<String> ActiveInput = new JComboBox<>(PinActivity.Behavior_strings);
    ActionListener actionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (e.getActionCommand().equals("cancel")) {
              MyType = IOComponentTypes.Unknown;
              abort = true;
            }
            selWindow.setVisible(false);
          }
        };
    GridBagLayout dialogLayout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    selWindow.setLayout(dialogLayout);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridy = -1;
    ArrayList<JTextField> LocInputs = new ArrayList<JTextField>();
    ArrayList<String> PinLabels;
    switch (MyType) {
      case SevenSegment:
        PinLabels = SevenSegment.GetLabels();
        break;
      case RGBLED:
        PinLabels = RGBLed.GetLabels();
        break;
      case DIPSwitch:
        PinLabels = DipSwitch.GetLabels(NrOfDevicePins);
        break;
      case PortIO:
        PinLabels = PortIO.GetLabels(NrOfDevicePins);
        break;
      case LocalBus:
        PinLabels = ReptarLocalBus.GetLabels();
        break;
      default:
        PinLabels = new ArrayList<String>();
        if (NrOfDevicePins == 1) {
          PinLabels.add("FPGA pin");
        } else {
          for (int i = 0; i < NrOfDevicePins; i++) {
            PinLabels.add("pin " + i);
          }
        }
    }
    int offset = 0;
    int oldY = c.gridy;
    int maxY = -1;
    for (int i = 0; i < NrOfDevicePins; i++) {
      if (i % 32 == 0) {
        offset = (i / 32) * 2;
        c.gridy = oldY;
      }
      JLabel LocText = new JLabel("Specify " + PinLabels.get(i) + " location:");
      c.gridx = 0 + offset;
      c.gridy++;
      selWindow.add(LocText, c);
      JTextField txt = new JTextField(6);
      LocInputs.add(txt);
      c.gridx = 1 + offset;
      selWindow.add(LocInputs.get(i), c);
      maxY = c.gridy > maxY ? c.gridy : maxY;
    }
    c.gridy = maxY;

    JLabel StandardText = new JLabel("Specify FPGA pin standard:");
    c.gridy++;
    c.gridx = 0;
    selWindow.add(StandardText, c);
    JComboBox<String> StandardInput = new JComboBox<>(IoStandards.Behavior_strings);
    StandardInput.setSelectedIndex(parent.GetDefaultStandard());
    c.gridx = 1;
    selWindow.add(StandardInput, c);

    if (IOComponentTypes.OutputComponentSet.contains(MyType)) {
      JLabel DriveText = new JLabel("Specify FPGA pin drive strength:");
      c.gridy++;
      c.gridx = 0;
      selWindow.add(DriveText, c);
      DriveInput.setSelectedIndex(parent.GetDefaultDriveStrength());
      c.gridx = 1;
      selWindow.add(DriveInput, c);
    }

    if (IOComponentTypes.InputComponentSet.contains(MyType)) {
      JLabel PullText = new JLabel("Specify FPGA pin pull behavior:");
      c.gridy++;
      c.gridx = 0;
      selWindow.add(PullText, c);
      PullInput.setSelectedIndex(parent.GetDefaultPullSelection());
      c.gridx = 1;
      selWindow.add(PullInput, c);
    }

    if (!IOComponentTypes.InOutComponentSet.contains(MyType)) {
      JLabel ActiveText = new JLabel("Specify " + MyType + " activity:");
      c.gridy++;
      c.gridx = 0;
      selWindow.add(ActiveText, c);
      ActiveInput.setSelectedIndex(parent.GetDefaultActivity());
      c.gridx = 1;
      selWindow.add(ActiveInput, c);
    }

    JButton OkayButton = new JButton("Done and Store");
    OkayButton.setActionCommand("done");
    OkayButton.addActionListener(actionListener);
    c.gridx = 0;
    c.gridy++;
    selWindow.add(OkayButton, c);

    JButton CancelButton = new JButton("Cancel");
    CancelButton.setActionCommand("cancel");
    CancelButton.addActionListener(actionListener);
    c.gridx = 1;
    selWindow.add(CancelButton, c);
    selWindow.pack();
    selWindow.setLocation(Projects.getCenteredLoc(selWindow.getWidth(), selWindow.getHeight()));
    // PointerInfo mouseloc = MouseInfo.getPointerInfo();
    // Point mlocation = mouseloc.getLocation();
    // selWindow.setLocation(mlocation.x, mlocation.y);
    selWindow.setModal(true);
    selWindow.setResizable(false);
    selWindow.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    selWindow.setAlwaysOnTop(true);
    abort = false;
    while (!abort) {
      selWindow.setVisible(true);
      if (!abort) {
        boolean correct = true;
        for (int i = 0; i < NrOfDevicePins; i++) {
          if (LocInputs.get(i).getText().isEmpty()) {
            correct = false;
            showDialogNotification(
                selWindow,
                "Error",
                "<html>You have to specify a location for " + PinLabels.get(i) + "!</html>");
            continue;
          }
        }
        if (correct) {
          parent.SetDefaultStandard(StandardInput.getSelectedIndex());
          NrOfPins = NrOfDevicePins;
          for (int i = 0; i < NrOfDevicePins; i++) {
            MyPinLocations.put(i, LocInputs.get(i).getText());
          }
          MyIOStandard = IoStandards.getId(StandardInput.getSelectedItem().toString());
          if (IOComponentTypes.OutputComponentSet.contains(MyType)) {
            parent.SetDefaultDriveStrength(DriveInput.getSelectedIndex());
            MyDriveStrength = DriveStrength.getId(DriveInput.getSelectedItem().toString());
          }
          if (IOComponentTypes.InputComponentSet.contains(MyType)) {
            parent.SetDefaultPullSelection(PullInput.getSelectedIndex());
            MyPullBehavior = PullBehaviors.getId(PullInput.getSelectedItem().toString());
          }
          if (!IOComponentTypes.InOutComponentSet.contains(MyType)) {
            parent.SetDefaultActivity(ActiveInput.getSelectedIndex());
            MyActivityLevel = PinActivity.getId(ActiveInput.getSelectedItem().toString());
          }
          abort = true;
        }
      }
    }
    selWindow.dispose();
  }