Exemplo n.º 1
0
void simnet() {

   // Input and output signals and buses
   Signal A(8);
   Signal B(8);
   Signal Sum(8, "Sum");
   Signal Carry(1, "C");
   Signal Overflow(1, "V");

   // A bus input switches
   Switch("1a", A[7], '7');
   Switch("1a", A[6], '6');
   Switch("1a", A[5], '5');
   Switch("1a", A[4], '4');
   Switch("1a", A[3], '3');
   Switch("1a", A[2], '2');
   Switch("1a", A[1], '1');
   Switch("1a", A[0], '0');
   Space(SD("1a", "A Bus"));

   // B bus input switches
   Switch("3a", B[7], '&');
   Switch("3a", B[6], '^');
   Switch("3a", B[5], '%');
   Switch("3a", B[4], '$');
   Switch("3a", B[3], '#');
   Switch("3a", B[2], '@');
   Switch("3a", B[1], '!');
   Switch("3a", B[0], ')');
   Space(SD("3a", "B Bus"));

   Add8("2b",
        //inputs:
        A, B,
        //outputs:
        Sum,
        Carry,
        Overflow
   );

   int parts[] = {4};
   Probe("1c-2c.1a", Sum, 1, parts );
   Space(SD("3c", "Sum"));

   Space(SD("3b"));
   Probe("3b", Overflow);
   Space(SD("3b", "Overflow"));

   Probe("3c", Carry);
   Space(SD("3c", "Carry"));
}
void simnet()
{
  Signal w, x, y, z, Present, a, b, c, d, e, f, g;
  Signal Strobe(1);
  Signal ResetA(1);
  Signal ResetB(1);
  

  Pulser ((SD("1a"), "r -- Reset counter"), ResetA, 'r',10000);
  Pulser ((SD("2a"), "s -- Strobe counter"), Strobe, 's', 10000);

  Not(SD("1b"), ResetA, ResetB); 

  Counter((SD("1c-2c"), "4-bit counter"), (ResetB, Strobe), (w,x,y,z));

 circuits( SD("1d-4d"), w, x, y, z, Present, a, b, c, d, e, f, g);

  Probe(( SD("1g"),"Present"), Present );
  Probe( (SD("2f-2h"),"a"), a );
  Probe( (SD("3f-4f"),"f"), f );
  Probe( (SD("3h-4h"),"b"), b );  
  Probe( (SD("5f-5h"),"g"), g );
  Probe( (SD("6f-7f"),"e"), e);
  Probe( (SD("6h-7h"),"c"), c);
  Probe( (SD("8f-8h"),"d"), d); 
}
void simnet()
{
  Signal w, x, y, z, Present, a, b, c, d, e, f, g;

  Signal Strobe (1);
  Signal ResetA (1);
  Signal ResetB (1);
  Signal Output (4);

  Pulser ((SD("1a"), "r -- Reset counter"),  ResetA, 'r', 10000);
  Pulser ((SD("2a"), "s -- Strobe counter"), Strobe, 's', 10000);

  Not (SD("1b"), ResetA, ResetB);

  Counter ((SD("1c-2c"), "4-bit counter"), (ResetB, Strobe),(w,x,y,z));

  circuits( SD("1d-4d"), w, x, y, z, Present, a, b, c, d, e, f, g);

  Probe((SD("0d"), "Present"), Present);
  Probe((SD("1f"), "a"), a);
  Probe((SD("2g"), "b"), b);
  Probe((SD("4g"), "c"), c);
  Probe((SD("5f"), "d"), d);
  Probe((SD("4e"), "e"), e);
  Probe((SD("2e"), "f"), f);
  Probe((SD("3f"), "g"), g);
}
Exemplo n.º 4
0
Arquivo: ps.c Projeto: mstorsjo/vlc
static bool FindLength( demux_t *p_demux )
{
    demux_sys_t *p_sys = p_demux->p_sys;
    int64_t i_current_pos = -1, i_size = 0, i_end = 0;

    if( !var_CreateGetBool( p_demux, "ps-trust-timestamps" ) )
        return true;

    if( p_sys->i_length == VLC_TICK_INVALID ) /* First time */
    {
        p_sys->i_length = VLC_TICK_0;
        /* Check beginning */
        int i = 0;
        i_current_pos = vlc_stream_Tell( p_demux->s );
        while( i < 40 && Probe( p_demux, false ) > 0 ) i++;

        /* Check end */
        i_size = stream_Size( p_demux->s );
        i_end = VLC_CLIP( i_size, 0, 200000 );
        if( vlc_stream_Seek( p_demux->s, i_size - i_end ) == VLC_SUCCESS )
        {
            i = 0;
            while( i < 400 && Probe( p_demux, true ) > 0 ) i++;
            if( i_current_pos >= 0 &&
                vlc_stream_Seek( p_demux->s, i_current_pos ) != VLC_SUCCESS )
                    return false;
        }
        else return false;
    }

    /* Find the longest track */
    for( int i = 0; i < PS_TK_COUNT; i++ )
    {
        ps_track_t *tk = &p_sys->tk[i];
        if( tk->i_first_pts != VLC_TICK_INVALID &&
            tk->i_last_pts > tk->i_first_pts )
        {
            vlc_tick_t i_length = tk->i_last_pts - tk->i_first_pts;
            if( i_length > p_sys->i_length )
            {
                p_sys->i_length = i_length;
                p_sys->i_time_track_index = i;
                msg_Dbg( p_demux, "we found a length of: %"PRId64 "s", SEC_FROM_VLC_TICK(p_sys->i_length) );
            }
        }
    }
    return true;
}
Exemplo n.º 5
0
void
DiskProbe::RefsReceived(BMessage* message)
{
	bool traverseLinks = (modifiers() & B_SHIFT_KEY) == 0;

	int32 index = 0;
	entry_ref ref;
	while (message->FindRef("refs", index++, &ref) == B_OK) {
		const char* attribute = NULL;
		if (message->FindString("attributes", index - 1, &attribute) == B_OK)
			traverseLinks = false;

		BEntry entry;
		status_t status = entry.SetTo(&ref, traverseLinks);

		if (status == B_OK)
			status = Probe(entry, attribute);

		if (status != B_OK) {
			char buffer[1024];
			snprintf(buffer, sizeof(buffer),
				B_TRANSLATE_COMMENT("Could not open \"%s\":\n"
				"%s", "Opening of entry reference buffer for a DiskProbe "
				"request Alert message. The name of entry reference and "
				"error message is shown."),
				ref.name, strerror(status));

			BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
				buffer, B_TRANSLATE("OK"), NULL, NULL,
				B_WIDTH_AS_USUAL, B_STOP_ALERT);
			alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
			alert->Go();
		}
	}
}
Exemplo n.º 6
0
void simnet() {
   Signal muxIn(4);
   Signal muxOut(1, "muxOut");
   Signal select(2);

   Space(SD("1b", "Note input/select line order: Incorrect order is a common mistake!"));       

   // Input lines
   Switch("1a", muxIn[3], '3');
   Space(SD("1a", "input[3]"));
   Switch("1a", muxIn[2], '2');
   Space(SD("1a", "input[2]"));
   Switch("1a", muxIn[1], '1');
   Space(SD("1a", "input[1]"));
   Switch("1a", muxIn[0], '0');
   Space(SD("1a", "input[0]"));

   // Select lines
   Switch("2b.1a", select[1], 'a');
   Space(SD("2b.2a", "select[1]"));
   Switch("2b.1b", select[0], 'b');
   Space(SD("2b.2b", "select[0]"));

   // select and muxIn are specified in MSB down to LSB order
   Mux("1b", select, muxIn, muxOut);

   Probe("1c", muxOut);
}
Exemplo n.º 7
0
int At250xx::Read(int probe, int type)
{
    UserDebug1(UserApp1, "At250xx::Read(%d)\n", probe);

    if (probe || GetNoOfBank() == 0)
        Probe();

    int size = GetNoOfBank() * GetBankSize();

    UserDebug1(UserApp1, "At250xx::Read() ** Size = %d\n", size);

    int rv = size;
    if (type & PROG_TYPE)
    {
        rv = GetBus()->Read(0, GetBufPtr(), size);
        if (rv != size)
        {
            if (rv > 0)
                rv = OP_ABORTED;
        }
    }

    UserDebug1(UserApp1, "At250xx::Read() = %d\n", rv);

    return rv;
}
Exemplo n.º 8
0
Arquivo: dpsdict.c Projeto: aosm/X11
/* -1 => not found */
PSWDictValue DPSWDictLookup(PSWDict dict, char *name)
{
  Entry e;
  e = Probe(dict, Hash(name, dict->nEntries), name);
  if (e == NIL) return -1;
  return e->value;
}
Exemplo n.º 9
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : origin - 
//			&m_vecDirection - 
//			&m_flForce - 
//-----------------------------------------------------------------------------
void C_BaseExplosionEffect::GetForceDirection( const Vector &origin, float magnitude, Vector *resultDirection, float *resultForce )
{
	Vector	d[6];

	//All cardinal directions
	d[0] = Vector(  1,  0,  0 );
	d[1] = Vector( -1,  0,  0 );
	d[2] = Vector(  0,  1,  0 );
	d[3] = Vector(  0, -1,  0 );
	d[4] = Vector(  0,  0,  1 );
	d[5] = Vector(  0,  0, -1 );

	//Init the results
	(*resultDirection).Init();
	(*resultForce) = 1.0f;
	
	//Get the aggregate force vector
	for ( int i = 0; i < 6; i++ )
	{
		(*resultForce) += Probe( origin, &d[i], magnitude );
		(*resultDirection) += d[i];
	}

	//If we've hit nothing, then point up
	if ( (*resultDirection) == vec3_origin )
	{
		(*resultDirection) = Vector( 0, 0, 1 );
		(*resultForce) = EXPLOSION_FORCE_MIN;
	}

	//Just return the direction
	VectorNormalize( (*resultDirection) );
}
Exemplo n.º 10
0
      void SimpleSendRecvImpl::RecvThread::run()
      {
        Group *g = (Group *)this->group;

        while (1) {
          MPI_Status status;
          // PING;fflush(0);
          MPI_CALL(Probe(MPI_ANY_SOURCE,g->tag,g->comm,&status));
          Action *action = new Action;
          action->addr = Address(g,status.MPI_SOURCE);

          MPI_CALL(Get_count(&status,MPI_BYTE,&action->size));

          action->data = malloc(action->size);
          double t0 = getSysTime();
          MPI_CALL(Recv(action->data,action->size,MPI_BYTE,status.MPI_SOURCE,status.MPI_TAG,
                        g->comm,MPI_STATUS_IGNORE));
          double t1 = getSysTime();
#if PROFILE_MPI
          if (logIt) {
            t_recv += (t1-t0);
            b_recv += action->size;

            MsgLog log;
            log.to = action->addr.rank;
            log.size = action->size;
            log.begin = t0;
            log.end = t1;
            recvLog.push_back(log);
          }
#endif
          g->procQueue.put(action);
        }
      }
Exemplo n.º 11
0
bool ChannelEditor::Create(void)
{
    if (!XMLParseBase::LoadWindowFromXML("osd.xml", "ChannelEditor", this))
        return false;

    MythUIButton *probeButton = NULL;
    MythUIButton *okButton    = NULL;

    bool err = false;
    UIUtilE::Assign(this, m_callsignEdit, "callsign", &err);
    UIUtilE::Assign(this, m_channumEdit,  "channum",  &err);
    UIUtilE::Assign(this, m_channameEdit, "channame", &err);
    UIUtilE::Assign(this, m_xmltvidEdit,  "XMLTV",    &err);
    UIUtilE::Assign(this, probeButton,    "probe",    &err);
    UIUtilE::Assign(this, okButton,       "ok",       &err);

    if (err)
    {
        LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'ChannelEditor'");
        return false;
    }

    BuildFocusList();
    connect(okButton,    SIGNAL(Clicked()), SLOT(Confirm()));
    connect(probeButton, SIGNAL(Clicked()), SLOT(Probe()));
    SetFocusWidget(okButton);

    return true;
}
void simnet()
{
  Signal Init, Clock, w, x, y, z;

  // Insert your Pulsers here
  
  Pulser ((SD("2a"), "i -- Initialization"), Init, 'i', 10000);
  Pulser ((SD("3a"), "c -- Clock"), Clock, 'c', 10000);

  circuits( SD("1b-4b"), Init, Clock, w, x, y, z );

  // Insert your Probes here 
  Probe ((SD("1c"), "w"), w);
  Probe ((SD("2c"), "x"), x);
  Probe ((SD("3c"), "y"), y);
  Probe ((SD("4c"), "z"), z);
}
Exemplo n.º 13
0
void HWStubDevice::Init(struct libusb_device *dev)
{
    libusb_ref_device(dev);
    m_dev = dev;
    m_handle = 0;
    m_hwdev = 0;
    m_valid = Probe();
}
Exemplo n.º 14
0
int Device::ReadCalibration(int addr)
{
	int val;
	val = Probe(0);
	if (val >= 0)
		val = GetBus()->ReadCalibration(addr);
	return val;
}
Exemplo n.º 15
0
void simnet()
{
  Signal Init, Clock, w, x, y, z;

  // Insert your Pulsers here
  // A pulser is used to generate a temporary value of "One" on a specified
  // signal line (signal value:  Zero ==> One ==> Zero)
  Pulser ((SD("ba"), "v -- Init"),  ResetA, 'v', 10001);
  Pulser ((SD("ca"), "c -- Clock"), clock_Strobe, 'c', 10000);

  circuits( SD("1b-4b"), Init, Clock, w, x, y, z );

  // Insert your Probes here
  Probe ((SD("bh"), "w"), w_probe);
  Probe ((SD("ch"), "x"), x_probe);
  Probe ((SD("dh"), "y"), y_probe);
  Probe ((SD("eh"), "z"), z_probe);
}
Exemplo n.º 16
0
long NameTable::Find (char *k)
{
	register NameTableEntry *e;

	for (e = Probe (k); e; e = e->next)
		if (! strcmp (e->key, k))
			return (e->value);
	return (-1);
}
Exemplo n.º 17
0
void simnet()
{
  Signal Init, Clock, w, x, y, z;


  Pulser ((SD("1a"), "Init"), Init, 'i', 1000);
  Pulser ((SD("4a"), "Clock"), Clock, 'c', 1000);
 // Insert your Pulsers here

  circuits( SD("1b-4b"), Init, Clock, w, x, y, z);
  

  Probe ( (SD("1e-1f"), "w"), w);
  Probe ( (SD("2e-2f"), "x"), x);
  Probe ( (SD("3e-3f"), "y"), y);
  Probe ( (SD("4e-4f"), "z"), z);
  
  // Insert your Probes here
}
Exemplo n.º 18
0
boolean Table::Find (void*& v, void* k) {
    register TableEntry* e;

    for (e = Probe(k); e != nil; e = e->chain) {
	if (e->key == k) {
	    v = e->value;
	    return true;
	}
    }
    return false;
}
Exemplo n.º 19
0
ECode TestCase::AddFailure(
    /* [in] */ ECode ec,
    /* [in] */ const String& message,
    /* [in] */ const String& backtrace)
{
    AutoPtr<ITestFailure> failure;
    CTestFailure::New((ITest*)Probe(EIID_ITest), ec,
            message, backtrace, (ITestFailure**)&failure);
    mFailures.PushBack(failure);
    return NOERROR;
}
Exemplo n.º 20
0
void simnet()
{
  Signal Init, Clock, w, x, y, z;
  

  // Insert your Pulsers here
  
  Pulser ((SD("1a"), "c - Clock"),  Clock, 'c', 10000);
  Pulser ((SD("2a"), "i - Init"), Init, 'i', 10000);


  circuits( SD("5b-8b"), Init, Clock, w, x, y, z );

  // Insert your Probes here
  Probe ((SD("2d"), "w"), w);
  Probe ((SD("3d"), "x"), x);
  Probe ((SD("4d"), "y"), y);
  Probe ((SD("5d"), "z"), z);

}
Exemplo n.º 21
0
ECode CEGLDisplayImpl::Equals(
        /* [in] */ IInterface *o,
        /* [out] */ Boolean *equals)
{
    if (Probe(EIID_IInterface) == o) return TRUE;
    if (o == NULL || IEGLDisplay::Probe(o) == NULL) return FALSE;

    CEGLDisplayImpl* that = (CEGLDisplayImpl*)(IEGLDisplay::Probe(o));

    *equals = mEGLDisplay == that->mEGLDisplay;
    return NOERROR;
}
Exemplo n.º 22
0
ECode TestCase::ToString(
    /* [out] */ String* str)
{
    VALIDATE_NOT_NULL(str);
    String name;
    GetName(&name);
    AutoPtr<IClassInfo> clazz;
    _CObject_ReflectClassInfo(Probe(EIID_ITest), (IClassInfo**)&clazz);
    StringBuf_<512> clazzName;
    clazz->GetName(&clazzName);
    *str = name + "(" + String((const char*)clazzName) + ")";
    return NOERROR;
}
Exemplo n.º 23
0
void simnet()
{
  Signal a, b, c, d, F;                   // Switch and output objects 

  Switch ( SD("1a"), a, 'a' );            // Switch a controlled by 'a' key
  Switch ( SD("2a"), b, 'b' );            // Switch b controlled by 'b' key
  Switch ( SD("3a"), c, 'c' );            // Switch c controlled by 'c' key
  Switch ( SD("4a"), d, 'd' );            // Switch d controlled by 'd' key
 
  circuit( SD("1c-4c"), a, b, c, d, F );

  Probe ( (SD("2e"), "F"), F );           // Probe
}
Exemplo n.º 24
0
ECode TestCase::RunTest()
{
    AutoPtr<ICharSequence> cseq;
    CStringWrapper::New(mName, (ICharSequence**)&cseq);
    FAIL_RETURN(AssertNotNull(String("TestCase.mName cannot be null"), cseq)); // Some VMs crash when calling getMethod(null,null);
    AutoPtr<IMethodInfo> runMethod;
    // try {
        // use getMethod to get all public inherited
        // methods. getDeclaredMethods returns all
        // methods of this class but excludes the
        // inherited ones.
    AutoPtr<IClassInfo> clazz;
    ECode ec = _CObject_ReflectClassInfo(Probe(EIID_ITest), (IClassInfo**)&clazz);
    if (SUCCEEDED(ec)) {
        ec = clazz->GetMethodInfo(mName.string(), (IMethodInfo**)&runMethod);
    }
    if (FAILED(ec)) return Fail(String("Method \"") + mName + String("\" not found"));
    // } catch (NoSuchMethodException e) {
    //     fail("Method \""+fName+"\" not found");
    // }
    // if (!Modifier.isPublic(runMethod.getModifiers())) {
    //     fail("Method \""+fName+"\" should be public");
    // }

    // try {
    ec = runMethod->Invoke(Probe(EIID_ITest), NULL);
    return ec;
    // }
    // catch (InvocationTargetException e) {
    //     e.fillInStackTrace();
    //     throw e.getTargetException();
    // }
    // catch (IllegalAccessException e) {
    //     e.fillInStackTrace();
    //     throw e;
    // }
}
Exemplo n.º 25
0
Arquivo: dpsdict.c Projeto: aosm/X11
/*  0 => normal return (not found)
   -1 => found. If found, value is replaced. */
PSWDictValue DPSWDictEnter(PSWDict dict, char *name, PSWDictValue value)
{
  Entry e;
  integer x = Hash(name, dict->nEntries);
  e = Probe(dict, x, name);
  if (e != NIL) {
    e->value = value;
    return -1;
    }
  e = (Entry)DPScalloc(sizeof(EntryRec), 1);
  e->next = (dict->entries)[x]; (dict->entries)[x] = e;
  e->value = value;
  e->name = name; /* MakeAtom(name); */
  return 0;
}
Exemplo n.º 26
0
	void* Module::operator[](std::string name) const
	{
		void* p = Probe(std::move(name));

		if (p == nullptr)
		{
#if defined(_WIN32)
			throw std::runtime_error(""); // FIXME: GetLastError string
#else
			throw std::runtime_error(dlerror());
#endif
		}

		return p;
	}
Exemplo n.º 27
0
Arquivo: dpsdict.c Projeto: aosm/X11
Atom DPSMakeAtom(char *name)
{
  Entry e;
  integer x = Hash(name, 511);
  char *newname;

  if (atoms == NIL) atoms = DPSCreatePSWDict(511);
  e = Probe(atoms, x, name);
  if (e == NIL) {
    e = (Entry)DPScalloc(sizeof(EntryRec), 1);
    e->next = (atoms->entries)[x]; (atoms->entries)[x] = e;
    e->value = 0;
    newname = (char *)DPScalloc(strlen(name)+1, 1);
    strcpy(newname, name);
    e->name = newname;
    }
  return (Atom) e->name;
}
      void MultiIsendIrecvImpl::RecvThread::run()
      {
        // note this thread not only _probes_ for new receives, it
        // also immediately starts the receive operation using Irecv()
        Group *g = (Group *)this->group;
        
        while (1) {
          MPI_Status status;
          MPI_CALL(Probe(MPI_ANY_SOURCE,g->tag,g->comm,&status));
          Action *action = new Action;
          action->addr = Address(g,status.MPI_SOURCE);

          MPI_CALL(Get_count(&status,MPI_BYTE,&action->size));

          action->data = malloc(action->size);
          MPI_CALL(Irecv(action->data,action->size,MPI_BYTE,status.MPI_SOURCE,status.MPI_TAG,
                        g->comm,&action->request));
          g->recvQueue.put(action);
        }
      }
Exemplo n.º 29
0
int At250xx::Write(int probe, int type)
{
    if (probe || GetNoOfBank() == 0)
        Probe();

    int size = GetNoOfBank() * GetBankSize();

    int rv = size;
    if (type & PROG_TYPE)
    {
        rv = GetBus()->Write(0, GetBufPtr(), size);
        if (rv != size)
        {
            if (rv > 0)
                rv = OP_ABORTED;
        }
    }

    return rv;
}
Exemplo n.º 30
0
void simnet() {

   // input to ROM
   Signal address(4, "address");
   Switch("1a", address[3], '3');
   Switch("1a", address[2], '2');
   Switch("1a", address[1], '1');
   Switch("1a", address[0], '0');

   // output from ROM
   Signal bits(8, "ROM Output");

   // burn the rom
   loadRom(romContents, NUM_WORDS, "romfile.txt");

   // instantiate the rom
   Rom("1b", address, bits, ROMSIZE, WORDSIZE, romContents);

   Probe("1c", bits);
}