XR02 Bus logic

Content outdated

We are in the process of migrating all content to impulse version 2.0.

This recJs script creates a simple bus logic. Download the script and open with the impulse viewer.

//-recjs (keep this line)
// generator: of ISingleDomainRecordGenerator(http://toem.de/index.php/projects/impulse/scripts/reference)
//

// Init the record
generator.initRecord("Example Record",TimeBase.ns);
progress.setTimeout(50000);

// Create a record with scopes and some signals
var signals = generator.addScope(null, "External Signals");
var clk = generator.addSignal(signals, "Clk", "", ProcessType.Discrete, SignalType.Logic, SignalDescriptor.DEFAULT);
var addrbus = generator.addSignal(signals, "Addr", "", ProcessType.Discrete, SignalType.Logic,SignalDescriptor.LogicWidth(32));
var databus = generator.addSignal(signals, "Data", "", ProcessType.Discrete, SignalType.Logic,SignalDescriptor.LogicWidth(8));
var en = generator.addSignal(signals, "Enable", "", ProcessType.Discrete, SignalType.Logic, SignalDescriptor.DEFAULT);
var rw = generator.addSignal(signals, "R_W", "", ProcessType.Discrete, SignalType.Logic, SignalDescriptor.DEFAULT);

console.println(generator.getScope("\\External Signals"));
console.println(generator.getSignal("\\External Signals\\Clk"));

// We start at 0 ns
var t = 0; // 0 ns
var MAX_T=100000;
var writer;
generator.open(t);

// init signals
generator.getWriter(addrbus).write(0,false,Logic.valueOf('u'));
generator.getWriter(databus).write(0,false,Logic.valueOf('u'));
generator.getWriter(rw).write(0, false, Logic.valueOf('u'));
generator.getWriter(en).write(0, false, Logic.valueOf('u'));
generator.getWriter(en).write(0, false, Logic.valueOf('u'));

// clk signal
writer = generator.getWriter(clk);
for (t=0;t<MAX_T;t+=50)
     writer.write(t, false,  Logic.valueOf(t % 100 == 0));

function generateWrite(t,a,d){

     generator.getWriter(addrbus).write(t,false,Logic.valueOf(new java.lang.Long(a)));
     generator.getWriter(addrbus).attachAssociation(en.getPath(),"Settle=${delta}", 65);
     generator.getWriter(databus).write(t+25,false,Logic.valueOf(new java.lang.Long(d)));
     generator.getWriter(databus).attachAssociation(databus.getPath(),"Full=${delta}/fa752e", 200);
     generator.getWriter(rw).write(t+50, false, Logic.valueOf(false));
     generator.getWriter(en).write(t+65, false, Logic.valueOf(false));
     generator.getWriter(en).write(t+115, false, Logic.valueOf(true));
     generator.getWriter(en).attachAssociation(addrbus.getPath(),"Delay=${delta}", 185);
}

for (var n = 0;n<MAX_T/300;n++)
      generateWrite(n*300,0x1000+n*4,Math.random()*255);

// And close finally
generator.close(MAX_T);

// add simple view
var config = generator.addConfiguration( "Demo", "");
var folder = generator.addFolderConfiguration( config, "My Folder", null);
generator.addSamplesConfiguration( folder, addrbus);
Download Script About the recJs format Open JavaDoc Reference

Result

toem

technical software and tooling

Company

Contact Us

This email address is being protected from spambots. You need JavaScript enabled to view it.