How to use signal method of Support Package

Best Unobtainium_ruby code snippet using Support.signal

SynchronousMemoryPort.java

Source:SynchronousMemoryPort.java Github

copy

Full Screen

1package name.martingeisse.esdk.core.library.memory;2import name.martingeisse.esdk.core.DesignItem;3import name.martingeisse.esdk.core.DesignItemOwned;4import name.martingeisse.esdk.core.library.clocked.ClockedItem;5import name.martingeisse.esdk.core.library.signal.BitSignal;6import name.martingeisse.esdk.core.library.signal.ClockSignal;7import name.martingeisse.esdk.core.library.signal.VectorSignal;8import name.martingeisse.esdk.core.tools.synthesis.verilog.SignalUsageConsumer;9import name.martingeisse.esdk.core.tools.synthesis.verilog.SynthesisPreparationContext;10import name.martingeisse.esdk.core.tools.synthesis.verilog.VerilogSignalDeclarationKeyword;11import name.martingeisse.esdk.core.tools.synthesis.verilog.VerilogWriter;12import name.martingeisse.esdk.core.tools.synthesis.verilog.contribution.EmptyVerilogContribution;13import name.martingeisse.esdk.core.tools.synthesis.verilog.contribution.VerilogContribution;14import name.martingeisse.esdk.core.tools.synthesis.verilog.expression.VerilogExpressionNesting;15import name.martingeisse.esdk.core.tools.synthesis.verilog.expression.VerilogExpressionWriter;16import name.martingeisse.esdk.core.tools.validation.ValidationContext;17import name.martingeisse.esdk.core.util.vector.Vector;18/**19 *20 */21public final class SynchronousMemoryPort extends ClockedItem implements MemoryPort {22 private final Memory memory;23 private final ReadSupport readSupport;24 private final WriteSupport writeSupport;25 private final ReadWriteInteractionMode readWriteInteractionMode;26 private BitSignal clockEnableSignal;27 private BitSignal writeEnableSignal;28 private VectorSignal addressSignal;29 private VectorSignal writeDataSignal;30 private boolean sampledClockEnable;31 private boolean sampledWriteEnable;32 private Vector sampledAddress;33 private Vector sampledWriteData;34 private Vector synchronousReadData;35 private final VectorSignal readDataSignal;36 SynchronousMemoryPort(ClockSignal clockSignal, Memory memory,37 ReadSupport readSupport, WriteSupport writeSupport,38 ReadWriteInteractionMode readWriteInteractionMode) {39 super(clockSignal);40 if (readSupport == null) {41 throw new IllegalArgumentException("readSupport is null");42 }43 if (writeSupport == null) {44 throw new IllegalArgumentException("writeSupport is null");45 }46 if (readWriteInteractionMode == null) {47 throw new IllegalArgumentException("readWriteInteractionMode is null");48 }49 this.memory = memory;50 this.readSupport = readSupport;51 this.writeSupport = writeSupport;52 this.readWriteInteractionMode = readWriteInteractionMode;53 switch (readSupport) {54 case ASYNCHRONOUS:55 readDataSignal = new AsynchronousReadDataSignal();56 break;57 case SYNCHRONOUS:58 synchronousReadData = Vector.of(memory.getMatrix().getColumnCount(), 0);59 readDataSignal = new SynchronousReadDataSignal();60 break;61 default:62 readDataSignal = null;63 break;64 }65 }66 public Memory getMemory() {67 return memory;68 }69 public ReadSupport getReadSupport() {70 return readSupport;71 }72 public WriteSupport getWriteSupport() {73 return writeSupport;74 }75 public ReadWriteInteractionMode getReadWriteInteractionMode() {76 return readWriteInteractionMode;77 }78 public VectorSignal getReadDataSignal() {79 return readDataSignal;80 }81 public BitSignal getClockEnableSignal() {82 return clockEnableSignal;83 }84 public void setClockEnableSignal(BitSignal clockEnableSignal) {85 this.clockEnableSignal = clockEnableSignal;86 }87 public BitSignal getWriteEnableSignal() {88 return writeEnableSignal;89 }90 public void setWriteEnableSignal(BitSignal writeEnableSignal) {91 this.writeEnableSignal = writeEnableSignal;92 }93 public VectorSignal getAddressSignal() {94 return addressSignal;95 }96 public void setAddressSignal(VectorSignal addressSignal) {97 this.addressSignal = addressSignal;98 }99 public VectorSignal getWriteDataSignal() {100 return writeDataSignal;101 }102 public void setWriteDataSignal(VectorSignal writeDataSignal) {103 this.writeDataSignal = writeDataSignal;104 }105 public enum ReadSupport {106 SYNCHRONOUS,107 ASYNCHRONOUS,108 NONE109 }110 public enum WriteSupport {111 SYNCHRONOUS,112 NONE113 }114 public enum ReadWriteInteractionMode {115 READ_FIRST,116 WRITE_FIRST,117 NO_READ // a.k.a. NO_CHANGE for Xilinx118 }119 // ----------------------------------------------------------------------------------------------------------------120 // helper signals121 // ----------------------------------------------------------------------------------------------------------------122 final class AsynchronousReadDataSignal extends DesignItem implements VectorSignal, DesignItemOwned {123 @Override124 public int getWidth() {125 return memory.getMatrix().getColumnCount();126 }127 @Override128 public Vector getValue() {129 return memory.getMatrix().getRow(addressSignal.getValue().getAsUnsignedInt());130 }131 @Override132 public VerilogContribution getVerilogContribution() {133 return new EmptyVerilogContribution();134 }135 @Override136 public void printVerilogImplementationExpression(VerilogExpressionWriter out) {137 out.printSignal(memory.getMemorySignal(), VerilogExpressionNesting.ALL);138 out.print('[');139 out.printSignal(addressSignal, VerilogExpressionNesting.ALL);140 out.print(']');141 }142 }143 final class SynchronousReadDataSignal extends DesignItem implements VectorSignal, DesignItemOwned {144 @Override145 public int getWidth() {146 return memory.getMatrix().getColumnCount();147 }148 @Override149 public Vector getValue() {150 return synchronousReadData;151 }152 @Override153 public VerilogContribution getVerilogContribution() {154 return new EmptyVerilogContribution();155 }156 @Override157 public void analyzeSignalUsage(SignalUsageConsumer consumer) {158 }159 @Override160 public void printVerilogImplementationExpression(VerilogExpressionWriter out) {161 // this signal must have been declared162 throw new UnsupportedOperationException("cannot write implementation expression for synchronous read data");163 }164 }165 // ----------------------------------------------------------------------------------------------------------------166 // simulation167 // ----------------------------------------------------------------------------------------------------------------168 @Override169 public void computeNextState() {170 sampledClockEnable = clockEnableSignal == null || clockEnableSignal.getValue();171 sampledWriteEnable = writeEnableSignal == null || writeEnableSignal.getValue();172 sampledAddress = addressSignal == null ? null : addressSignal.getValue();173 sampledWriteData = writeDataSignal == null ? null : writeDataSignal.getValue();174 }175 @Override176 public void updateState() {177 if (!sampledClockEnable) {178 // inactive179 return;180 }181 int rowIndex = sampledAddress.getAsUnsignedInt();182 Vector currentSynchronousReadResult = memory.getMatrix().getRow(rowIndex);183 if (writeSupport != WriteSupport.SYNCHRONOUS || !sampledWriteEnable) {184 // read185 synchronousReadData = currentSynchronousReadResult;186 return;187 }188 // write189 memory.getMatrix().setRow(rowIndex, sampledWriteData);190 switch (readWriteInteractionMode) {191 case NO_READ:192 break;193 case READ_FIRST:194 synchronousReadData = currentSynchronousReadResult;195 break;196 case WRITE_FIRST:197 synchronousReadData = sampledWriteData;198 break;199 }200 }201 // ----------------------------------------------------------------------------------------------------------------202 // Verilog generation203 // ----------------------------------------------------------------------------------------------------------------204 @Override205 public VerilogContribution getVerilogContribution() {206 return new EmptyVerilogContribution();207 }208 @Override209 public void validate(ValidationContext context) {210 if (addressSignal == null) {211 context.reportError("no address signal");212 }213 if (writeSupport != WriteSupport.NONE && writeDataSignal == null) {214 context.reportError("synchronous memory port with write support but no write data signal");215 }216 if (writeSupport == WriteSupport.NONE && writeEnableSignal != null) {217 context.reportError("synchronous memory port with write enable signal but no write support");218 }219 if (writeSupport == WriteSupport.NONE && writeDataSignal != null) {220 context.reportError("synchronous memory port with write data signal but no write support");221 }222 }223 @Override224 public void prepareSynthesis(SynthesisPreparationContext context) {225 if (readSupport == ReadSupport.SYNCHRONOUS) {226 context.declareSignal(readDataSignal, VerilogSignalDeclarationKeyword.REG, false);227 }228 }229 @Override230 public void analyzeSignalUsage(SignalUsageConsumer consumer) {231 consumer.consumeSignalUsage(clockEnableSignal, VerilogExpressionNesting.SELECTIONS_SIGNALS_AND_CONSTANTS);232 consumer.consumeSignalUsage(writeEnableSignal, VerilogExpressionNesting.SELECTIONS_SIGNALS_AND_CONSTANTS);233 consumer.consumeSignalUsage(addressSignal, VerilogExpressionNesting.SIGNALS_AND_CONSTANTS);234 consumer.consumeSignalUsage(writeDataSignal, VerilogExpressionNesting.SIGNALS_AND_CONSTANTS);...

Full Screen

Full Screen

SignalSupport.java

Source:SignalSupport.java Github

copy

Full Screen

...15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.netbeans.modules.nativeexecution.signals;20import java.util.Collection;21import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;22import org.netbeans.modules.nativeexecution.api.util.Signal;23import org.openide.util.Lookup;24public final class SignalSupport {25 public enum SIGNAL_SCOPE {26 SIGNAL_PROCESS,27 SIGNAL_GROUP,28 SIGNAL_SESSION,29 SIGNAL_BY_ENV,30 SIGQUEUE_PROCESS31 }32 public static int signalProcess(ExecutionEnvironment env, int pid, Signal signal) {33 final Collection<? extends SignalSupportImplementation> impls = Lookup.getDefault().lookupAll(SignalSupportImplementation.class);34 for (SignalSupportImplementation impl : impls) {35 if (impl.isSupported(env, SIGNAL_SCOPE.SIGNAL_PROCESS)) {36 try {37 return impl.sendSignal(env, SIGNAL_SCOPE.SIGNAL_PROCESS, pid, signal);38 } catch (UnsupportedOperationException ex) {39 // try next40 }41 }42 }43 throw new UnsupportedOperationException("Sending signal to a pid is not supported on " + env.getDisplayName()); // NOI18N44 }45 public static int signalProcessGroup(ExecutionEnvironment env, int gid, Signal signal) {46 final Collection<? extends SignalSupportImplementation> impls = Lookup.getDefault().lookupAll(SignalSupportImplementation.class);47 for (SignalSupportImplementation impl : impls) {48 if (impl.isSupported(env, SIGNAL_SCOPE.SIGNAL_GROUP)) {49 try {50 return impl.sendSignal(env, SIGNAL_SCOPE.SIGNAL_GROUP, gid, signal);51 } catch (UnsupportedOperationException ex) {52 // try next53 }54 }55 }56 throw new UnsupportedOperationException("Sending signal to a group of processes is not supported on " + env.getDisplayName()); // NOI18N57 }58 public static int signalProcessSession(ExecutionEnvironment env, int psid, Signal signal) {59 final Collection<? extends SignalSupportImplementation> impls = Lookup.getDefault().lookupAll(SignalSupportImplementation.class);60 for (SignalSupportImplementation impl : impls) {61 if (impl.isSupported(env, SIGNAL_SCOPE.SIGNAL_SESSION)) {62 try {63 return impl.sendSignal(env, SIGNAL_SCOPE.SIGNAL_SESSION, psid, signal);64 } catch (UnsupportedOperationException ex) {65 // try next66 }67 }68 }69 throw new UnsupportedOperationException("Sending signal to a session of processes is not supported on " + env.getDisplayName()); // NOI18N70 }71 public static int signalProcessesByEnv(ExecutionEnvironment env, String environment, Signal signal) {72 final Collection<? extends SignalSupportImplementation> impls = Lookup.getDefault().lookupAll(SignalSupportImplementation.class);73 for (SignalSupportImplementation impl : impls) {74 if (impl.isSupported(env, SIGNAL_SCOPE.SIGNAL_BY_ENV)) {75 try {76 return impl.sendSignal(env, environment, signal);77 } catch (UnsupportedOperationException ex) {78 // try next79 }80 }81 }82 throw new UnsupportedOperationException("Sending signal to processes by env is not supported on " + env.getDisplayName()); // NOI18N83 }84 public static int sigqueue(ExecutionEnvironment env, int pid, Signal signal, int sigvalue) {85 final Collection<? extends SignalSupportImplementation> impls = Lookup.getDefault().lookupAll(SignalSupportImplementation.class);86 int result = 0;87 for (SignalSupportImplementation impl : impls) {88 if (impl.isSupported(env, SIGNAL_SCOPE.SIGQUEUE_PROCESS)) {89 try {90 result = impl.sigqueue(env, pid, signal, sigvalue);91 if (result >= 0) {92 return result;93 }94 } catch (UnsupportedOperationException ex) {95 // try next96 }97 }98 }99 if (result == 0) {100 throw new UnsupportedOperationException("Sigqueue is not supported on " + env.getDisplayName()); // NOI18N101 }102 return result;103 }104}...

Full Screen

Full Screen

CancellationSignal_OnCancelListenerImplementor.java

Source:CancellationSignal_OnCancelListenerImplementor.java Github

copy

Full Screen

1package mono.android.support.v4.os;2public class CancellationSignal_OnCancelListenerImplementor3 extends java.lang.Object4 implements5 mono.android.IGCUserPeer,6 android.support.v4.os.CancellationSignal.OnCancelListener7{8/** @hide */9 public static final String __md_methods;10 static {11 __md_methods = 12 "n_onCancel:()V:GetOnCancelHandler:Android.Support.V4.OS.CancellationSignal/IOnCancelListenerInvoker, Xamarin.Android.Support.Compat\n" +13 "";14 mono.android.Runtime.register ("Android.Support.V4.OS.CancellationSignal+IOnCancelListenerImplementor, Xamarin.Android.Support.Compat", CancellationSignal_OnCancelListenerImplementor.class, __md_methods);15 }16 public CancellationSignal_OnCancelListenerImplementor ()17 {18 super ();19 if (getClass () == CancellationSignal_OnCancelListenerImplementor.class)20 mono.android.TypeManager.Activate ("Android.Support.V4.OS.CancellationSignal+IOnCancelListenerImplementor, Xamarin.Android.Support.Compat", "", this, new java.lang.Object[] { });21 }22 public void onCancel ()23 {24 n_onCancel ();25 }26 private native void n_onCancel ();27 private java.util.ArrayList refList;28 public void monodroidAddReference (java.lang.Object obj)29 {30 if (refList == null)31 refList = new java.util.ArrayList ();32 refList.add (obj);33 }34 public void monodroidClearReferences ()35 {36 if (refList != null)37 refList.clear ();38 }39}...

Full Screen

Full Screen

signal

Using AI Code Generation

copy

Full Screen

1Signal.trap("INT") { 2}3Signal.trap("INT") { 4}5Signal.trap("INT") { 6}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Unobtainium_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful