wire up simulator trace writing interface

This commit is contained in:
Jacob Lifshay 2024-11-17 21:02:44 -08:00
parent 288a6b71b9
commit 09aa9fbc78
Signed by: programmerjake
SSH key fingerprint: SHA256:HnFTLGpSm4Q4Fj502oCFisjZSoakwEuTsJJMSke63RQ
6 changed files with 1046 additions and 184 deletions

View file

@ -117,10 +117,33 @@ fn test_connect_const() {
made_initial_step: true,
trace_decls: TraceModule {
name: "connect_const",
children: [],
children: [
TraceModuleIO {
name: "o",
child: TraceUInt {
id: TraceScalarId(0),
name: "o",
ty: UInt<8>,
flow: Sink,
},
ty: UInt<8>,
flow: Sink,
},
],
},
traces: [],
traces: [
SimTrace {
id: TraceScalarId(0),
kind: BigUInt {
index: StatePartIndex<BigSlots>(0),
ty: UInt<8>,
},
state: 0x05,
last_state: 0x05,
},
],
trace_writers: [],
instant: 0 s,
}"# {
panic!();
}
@ -681,10 +704,277 @@ fn test_mod1() {
made_initial_step: true,
trace_decls: TraceModule {
name: "mod1",
children: [],
children: [
TraceModuleIO {
name: "o",
child: TraceBundle {
name: "o",
fields: [
TraceUInt {
id: TraceScalarId(0),
name: "i",
ty: UInt<4>,
flow: Source,
},
TraceSInt {
id: TraceScalarId(1),
name: "o",
ty: SInt<2>,
flow: Sink,
},
TraceSInt {
id: TraceScalarId(2),
name: "i2",
ty: SInt<2>,
flow: Source,
},
TraceUInt {
id: TraceScalarId(3),
name: "o2",
ty: UInt<4>,
flow: Sink,
},
],
ty: Bundle {
#[hdl(flip)] /* offset = 0 */
i: UInt<4>,
/* offset = 4 */
o: SInt<2>,
#[hdl(flip)] /* offset = 6 */
i2: SInt<2>,
/* offset = 8 */
o2: UInt<4>,
},
flow: Sink,
},
ty: Bundle {
#[hdl(flip)] /* offset = 0 */
i: UInt<4>,
/* offset = 4 */
o: SInt<2>,
#[hdl(flip)] /* offset = 6 */
i2: SInt<2>,
/* offset = 8 */
o2: UInt<4>,
},
flow: Sink,
},
TraceInstance {
name: "child",
instance_io: TraceBundle {
name: "child",
fields: [
TraceUInt {
id: TraceScalarId(8),
name: "i",
ty: UInt<4>,
flow: Sink,
},
TraceSInt {
id: TraceScalarId(9),
name: "o",
ty: SInt<2>,
flow: Source,
},
TraceSInt {
id: TraceScalarId(10),
name: "i2",
ty: SInt<2>,
flow: Sink,
},
TraceUInt {
id: TraceScalarId(11),
name: "o2",
ty: UInt<4>,
flow: Source,
},
],
ty: Bundle {
#[hdl(flip)] /* offset = 0 */
i: UInt<4>,
/* offset = 4 */
o: SInt<2>,
#[hdl(flip)] /* offset = 6 */
i2: SInt<2>,
/* offset = 8 */
o2: UInt<4>,
},
flow: Source,
},
module: TraceModule {
name: "mod1_child",
children: [
TraceModuleIO {
name: "i",
child: TraceUInt {
id: TraceScalarId(4),
name: "i",
ty: UInt<4>,
flow: Source,
},
ty: UInt<4>,
flow: Source,
},
TraceModuleIO {
name: "o",
child: TraceSInt {
id: TraceScalarId(5),
name: "o",
ty: SInt<2>,
flow: Sink,
},
ty: SInt<2>,
flow: Sink,
},
TraceModuleIO {
name: "i2",
child: TraceSInt {
id: TraceScalarId(6),
name: "i2",
ty: SInt<2>,
flow: Source,
},
ty: SInt<2>,
flow: Source,
},
TraceModuleIO {
name: "o2",
child: TraceUInt {
id: TraceScalarId(7),
name: "o2",
ty: UInt<4>,
flow: Sink,
},
ty: UInt<4>,
flow: Sink,
},
],
},
ty: Bundle {
#[hdl(flip)] /* offset = 0 */
i: UInt<4>,
/* offset = 4 */
o: SInt<2>,
#[hdl(flip)] /* offset = 6 */
i2: SInt<2>,
/* offset = 8 */
o2: UInt<4>,
},
},
],
},
traces: [],
traces: [
SimTrace {
id: TraceScalarId(0),
kind: BigUInt {
index: StatePartIndex<BigSlots>(0),
ty: UInt<4>,
},
state: 0xa,
last_state: 0xa,
},
SimTrace {
id: TraceScalarId(1),
kind: BigSInt {
index: StatePartIndex<BigSlots>(1),
ty: SInt<2>,
},
state: 0x2,
last_state: 0x2,
},
SimTrace {
id: TraceScalarId(2),
kind: BigSInt {
index: StatePartIndex<BigSlots>(2),
ty: SInt<2>,
},
state: 0x2,
last_state: 0x2,
},
SimTrace {
id: TraceScalarId(3),
kind: BigUInt {
index: StatePartIndex<BigSlots>(3),
ty: UInt<4>,
},
state: 0xf,
last_state: 0xf,
},
SimTrace {
id: TraceScalarId(4),
kind: BigUInt {
index: StatePartIndex<BigSlots>(8),
ty: UInt<4>,
},
state: 0xa,
last_state: 0xa,
},
SimTrace {
id: TraceScalarId(5),
kind: BigSInt {
index: StatePartIndex<BigSlots>(9),
ty: SInt<2>,
},
state: 0x2,
last_state: 0x2,
},
SimTrace {
id: TraceScalarId(6),
kind: BigSInt {
index: StatePartIndex<BigSlots>(10),
ty: SInt<2>,
},
state: 0x2,
last_state: 0x2,
},
SimTrace {
id: TraceScalarId(7),
kind: BigUInt {
index: StatePartIndex<BigSlots>(11),
ty: UInt<4>,
},
state: 0xf,
last_state: 0xf,
},
SimTrace {
id: TraceScalarId(8),
kind: BigUInt {
index: StatePartIndex<BigSlots>(4),
ty: UInt<4>,
},
state: 0xa,
last_state: 0xa,
},
SimTrace {
id: TraceScalarId(9),
kind: BigSInt {
index: StatePartIndex<BigSlots>(5),
ty: SInt<2>,
},
state: 0x2,
last_state: 0x2,
},
SimTrace {
id: TraceScalarId(10),
kind: BigSInt {
index: StatePartIndex<BigSlots>(6),
ty: SInt<2>,
},
state: 0x2,
last_state: 0x2,
},
SimTrace {
id: TraceScalarId(11),
kind: BigUInt {
index: StatePartIndex<BigSlots>(7),
ty: UInt<4>,
},
state: 0xf,
last_state: 0xf,
},
],
trace_writers: [],
instant: 0 s,
}"# {
panic!();
}