more context

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2022-04-07 15:24:03 +08:00
parent 0decfd5ea5
commit f4dca24bac
5 changed files with 119 additions and 154 deletions

View File

@ -217,10 +217,11 @@
</section> </section>
<section data-transition="fade-in slide-out"> <section data-transition="fade-in slide-out">
<h2>What is an Emulator?</h2> <h2>What is an Emulator?</h2>
<img src="media/bbs-example.png"> <img src="media/vt100-MA-4352.png">
</section> </section>
<section> <section>
<h2>Emulation Depends on your Goals!</h2> <h2>Emulation Depends on your Goals!</h2>
<p class="fragment">Emulation is a lie</p>
</section> </section>
<!-- <section> <!-- <section>
<h2>Renode Is Many of These</h2> <h2>Renode Is Many of These</h2>
@ -233,11 +234,7 @@
</section> </section>
<section> <section>
<section data-transition="fade-out"> <section data-transition="slide-in fade-out">
<h2>What is a Computer?</h2>
<img class="fragment" src="media/bluenrg-block-diagram.png">
</section>
<section data-transition="fade">
<h2>What is a Computer?</h2> <h2>What is a Computer?</h2>
<ul> <ul>
<li>A system of devices</li> <li>A system of devices</li>
@ -292,10 +289,11 @@
IRQ -> cpu@0 IRQ -> cpu@0
cpu: CPU.CortexM @ sysbus cpu: CPU.CortexM @ sysbus
nvic: nvic
cpuType: "cortex-m0+" cpuType: "cortex-m0+"
PerformanceInMips: 24 PerformanceInMips: 24
nvic: nvic
</code></pre> </code></pre>
bluenrg-1.repl
</section> </section>
</section> </section>
@ -412,10 +410,11 @@
cpuType: "cortex-m0+" cpuType: "cortex-m0+"
PerformanceInMips: 24 PerformanceInMips: 24
</code></pre> </code></pre>
bluenrg-1.repl
</section> </section>
<section> <section>
<h2>Setting up Renode</h2> <h2>Setting up Renode</h2>
<pre data-id="code-animation"><code data-trim> <pre data-id="code-animation"><code data-trim data-line-numbers="|1|2|3-5|6|">
machine LoadPlatformDescription @bluenrg-1.repl machine LoadPlatformDescription @bluenrg-1.repl
sysbus LoadBinary @BLE_Chat_Server.bin 0x10040000 sysbus LoadBinary @BLE_Chat_Server.bin 0x10040000
cpu VectorTableOffset 0x10040000 cpu VectorTableOffset 0x10040000
@ -464,151 +463,96 @@
<h2>Modify an Existing Block</h2> <h2>Modify an Existing Block</h2>
</section> </section>
<section> <section>
<h2>Example Serial Port: LiteX UART</h2> <h2>Example Serial Port: AxiUartLite</h2>
<pre class="code-animation"><code class="cs" data-trim data-line-numbers="|132-140|118-126|125|20-33"> <pre class="code-animation"><code class="cs" data-trim data-line-numbers="|80-83|55-61|35-45|39-45">
// //
// Copyright (c) 2010-2018 Antmicro // Copyright (c) 2010-2018 Antmicro
// //
// This file is licensed under the MIT License. // This file is licensed under the MIT License.
// Full license text is available in 'licenses/MIT.txt'. // Full license text is available in 'licenses/MIT.txt'.
// //
using System.Collections.Generic; using System;
using Antmicro.Renode.Peripherals.Bus; using Antmicro.Renode.Peripherals.Bus;
using Antmicro.Renode.Core.Structure.Registers; using System.Collections.Generic;
using Antmicro.Renode.Core; using Antmicro.Renode.Core;
using Antmicro.Renode.Logging; using Antmicro.Renode.Logging;
using Antmicro.Renode.Peripherals.Miscellaneous;
namespace Antmicro.Renode.Peripherals.UART using Antmicro.Migrant;
{
public class LiteX_UART : UARTBase, IDoubleWordPeripheral, IBytePeripheral, IKnownSize namespace Antmicro.Renode.Peripherals.UART
{ {
public LiteX_UART(Machine machine) : base(machine) [AllowedTranslations(AllowedTranslation.ByteToDoubleWord)]
public class AxiUartLite : IDoubleWordPeripheral, IUART, IKnownSize
{ {
IRQ = new GPIO(); public AxiUartLite()
var registersMap = new Dictionary&lt;long, DoubleWordRegister>
{ {
{(long)Registers.RxTx, new DoubleWordRegister(this) readFifo = new Queue&lt;uint>();
.WithValueField(0, 8,
writeCallback: (_, value) =>
this.TransmitCharacter((byte)value),
valueProviderCallback: _ => {
if(!TryGetCharacter(out var character))
{
this.Log(LogLevel.Warning, "Empty Rx FIFO.");
}
return character;
})
},
{(long)Registers.TxFull, new DoubleWordRegister(this)
.WithFlag(0, FieldMode.Read) //tx is never full
},
{(long)Registers.RxEmpty, new DoubleWordRegister(this)
.WithFlag(0, FieldMode.Read, valueProviderCallback: _ => Count == 0)
},
{(long)Registers.EventPending, new DoubleWordRegister(this)
// `txEventPending` implements `WriteOneToClear` semantics to avoid fake warnings
// `txEventPending` is generated on the falling edge of TxFull; in our case it means never
.WithFlag(0, FieldMode.Read | FieldMode.WriteOneToClear, valueProviderCallback: _ => false, name: "txEventPending")
.WithFlag(1, out rxEventPending, FieldMode.Read | FieldMode.WriteOneToClear, name: "rxEventPending")
.WithWriteCallback((_, __) => UpdateInterrupts())
},
{(long)Registers.EventEnable, new DoubleWordRegister(this)
.WithFlag(0, name: "txEventEnabled")
.WithFlag(1, out rxEventEnabled)
.WithWriteCallback((_, __) => UpdateInterrupts())
},
};
registers = new DoubleWordRegisterCollection(this, registersMap);
}
public uint ReadDoubleWord(long offset)
{
return registers.Read(offset);
}
public byte ReadByte(long offset)
{
if(offset % 4 != 0)
{
// in the current configuration, only the lowest byte
// contains a meaningful data
return 0;
} }
return (byte)ReadDoubleWord(offset);
} public void WriteChar(byte value)
public override void Reset()
{
base.Reset();
registers.Reset();
UpdateInterrupts();
}
public void WriteDoubleWord(long offset, uint value)
{
registers.Write(offset, value);
}
public void WriteByte(long offset, byte value)
{
if(offset % 4 != 0)
{ {
// in the current configuration, only the lowest byte readFifo.Enqueue(value);
// contains a meaningful data }
return;
public void Reset()
{
readFifo.Clear();
}
public uint ReadDoubleWord(long offset)
{
switch((Register)offset)
{
case Register.RxFIFO:
if(readFifo.Count == 0)
{
this.Log(LogLevel.Warning, "Trying to read from empty fifo.");
return 0;
}
return readFifo.Dequeue();
case Register.Status:
// Tx FIFO Empty | Rx FIFO Valid Data
return (1u &lt;&lt; 2) | (readFifo.Count == 0 ? 0 : 1u);
default:
this.LogUnhandledRead(offset);
return 0;
}
}
public void WriteDoubleWord(long offset, uint value)
{
switch((Register)offset)
{
case Register.TxFIFO:
CharReceived?.Invoke((byte)value);
break;
default:
this.LogUnhandledWrite(offset, value);
break;
}
}
[field: Transient]
public event Action&lt;byte> CharReceived;
public long Size { get { return 0x10; } }
public Bits StopBits { get { return Bits.One; } }
public Parity ParityBit { get { return Parity.None; } }
public uint BaudRate { get { return 0; } }
private readonly Queue&lt;uint> readFifo;
private enum Register
{
RxFIFO = 0x0,
TxFIFO = 0x4,
Status = 0x8,
Control = 0xC
} }
WriteDoubleWord(offset, value);
} }
}
public long Size => 0x100;
public GPIO IRQ { get; private set; }
public override Bits StopBits => Bits.One;
public override Parity ParityBit => Parity.None;
public override uint BaudRate => 115200;
protected override void CharWritten()
{
UpdateInterrupts();
}
protected override void QueueEmptied()
{
UpdateInterrupts();
}
private void UpdateInterrupts()
{
// rxEventPending is latched
rxEventPending.Value = (Count != 0);
// tx fifo is never full, so `txEventPending` is always false
var eventPending = (rxEventEnabled.Value && rxEventPending.Value);
IRQ.Set(eventPending);
}
private IFlagRegisterField rxEventEnabled;
private IFlagRegisterField rxEventPending;
private readonly DoubleWordRegisterCollection registers;
private enum Registers : long
{
RxTx = 0x0,
TxFull = 0x04,
RxEmpty = 0x08,
EventStatus = 0x0c,
EventPending = 0x10,
EventEnable = 0x14,
}
}
}
</code></pre> </code></pre>
AxiUartLite.cs
</section> </section>
<section> <section>
<h2>Steps to Set Up a Serial Port</h2> <h2>Steps to Set Up a Serial Port</h2>
@ -629,10 +573,12 @@
<section> <section>
<h2>Peripheral Rapid Development</h2> <h2>Peripheral Rapid Development</h2>
<img src="media/hardware-20191117-cropped.jpg"> <img src="media/hardware-20191117-cropped.jpg">
Betrusted Prototype
</section> </section>
<section> <section>
<h2>Peripheral Rapid Development</h2> <h2>Peripheral Rapid Development</h2>
<video class="r-stretch" data-autoplay src="media/Renode-20191117-trimmed.m4v"></video> <video class="r-stretch" data-autoplay src="media/Renode-20191117-trimmed.m4v"></video>
<p>Hackaday Supercon 2019</p>
</section> </section>
<section data-transition="fade-out"> <section data-transition="fade-out">
<h2>Advantages of Emulation</h2> <h2>Advantages of Emulation</h2>
@ -642,6 +588,11 @@
<h2>Advantages of Emulation</h2> <h2>Advantages of Emulation</h2>
<img src="media/renode-xous-double-uart-tiled.png"> <img src="media/renode-xous-double-uart-tiled.png">
</section> </section>
<section>
<h2>Getting Hardware to Users</h2>
<img src="media/betrusted-engine-block-diagram.png" class="r-stretch">
<p>Betrusted ENGINE</p>
</section>
<section> <section>
<h2>Getting Hardware to Users</h2> <h2>Getting Hardware to Users</h2>
<img src="media/betrusted-wycheproof-patch.png"> <img src="media/betrusted-wycheproof-patch.png">
@ -650,6 +601,9 @@
<h2>Getting Hardware to Users</h2> <h2>Getting Hardware to Users</h2>
<img src="media/betrusted-wycheproof-patch-fix.png"> <img src="media/betrusted-wycheproof-patch-fix.png">
</section> </section>
<section>
<h2>Emulation brings more eyes to the project</h2>
</section>
</section> </section>
<!-- <!--
<section> <section>
@ -722,7 +676,7 @@
<section> <section>
<section> <section>
<h2>Robot Framework: Running Tests in CI</h2> <h2>Robot Framework: Running Tests in CI</h2>
<pre class="code-animation"><code class="robot" data-trim data-line-numbers="|1-6|8-18|20-26|28-40"> <pre class="code-animation"><code class="robot" data-trim data-line-numbers="|1-6|8-18|20-26|28-40|39-40">
*** Settings *** *** Settings ***
Suite Setup Setup Suite Setup Setup
Suite Teardown Teardown Suite Teardown Teardown
@ -746,24 +700,25 @@
Create Machine Create Machine
Execute Command mach create Execute Command mach create
Execute Command machine Execute Command machine
... LoadPlatformDescriptionFromString ${LIS2DS12} ... LoadPlatformDescriptionFromString ${LIS2DS12}
Execute Command sysbus LoadELF Execute Command sysbus LoadELF
... ${URI}/nrf52840--zephyr_lis2dh.elf-s_747800-163b7e7cc986d4b1115f06b5f3df44ed0defc1fa ... ${URI}/nrf52840--zephyr_lis2dh.elf-s_747800-163b7e7cc986d4b1115f06b5f3df44ed0defc1fa
*** Test Cases *** *** Test Cases ***
Should Read Acceleration Should Read Acceleration
Create Machine Create Machine
Create Terminal Tester ${UART} Create Terminal Tester ${UART}
Execute Command sysbus.twi1.lis2ds12 AccelerationX 10 Execute Command sysbus.twi1.lis2ds12 AccelerationX 10
Execute Command sysbus.twi1.lis2ds12 AccelerationY 5 Execute Command sysbus.twi1.lis2ds12 AccelerationY 5
Execute Command sysbus.twi1.lis2ds12 AccelerationZ -5 Execute Command sysbus.twi1.lis2ds12 AccelerationZ -5
Start Emulation Start Emulation
Wait For Line On Uart Wait For Line On Uart
... x 9.997213 , y 4.997410 , z -4.999803 ... x 9.997213 , y 4.997410 , z -4.999803
</code></pre> </code></pre>
<p>LIS2DS12.robot</p>
</section> </section>
</section> </section>
<section> <section>
@ -772,7 +727,7 @@
</section> </section>
<section> <section>
<h2>SVD: Standard Chip Documentation</h2> <h2>SVD: Standard Chip Documentation</h2>
<pre class="code-animation"><code class="xml" data-trim data-line-numbers="|3-9|25-87|27-31|39-57|43|46-47|48-56"> <pre class="code-animation"><code class="xml" data-trim data-line-numbers="|3-9|25-87|27-31|31|39-57|41|43|46-47|48-56">
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.1" xsi:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_1_draft.xsd"> <device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.1" xsi:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_1_draft.xsd">
<vendor>STMicroelectronics</vendor> <vendor>STMicroelectronics</vendor>
@ -862,6 +817,7 @@
</peripherals> </peripherals>
</device> </device>
</code></pre> </code></pre>
<p>BlueNRG2.svd</p>
</section> </section>
<section> <section>
<h2>SVD: Using with Renode</h2> <h2>SVD: Using with Renode</h2>
@ -895,6 +851,15 @@
<img src="media/renode-multi-system.png"> <img src="media/renode-multi-system.png">
</section> </section>
</section> </section>
<section>
<h2>Other Features</h2>
<ul>
<li>Loading peripherals at runtime</li>
<li>Adding custom instructions to Risc-V</li>
<li>Python hooks for memory access</li>
<li>Networking</li>
</ul>
</section>
<section> <section>
<h2>Renode is Free Software</h2> <h2>Renode is Free Software</h2>
Give it a try! Give it a try!

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
media/frame.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
media/vt100-MA-4352.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

BIN
media/vt100-MA-4356.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB