Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

8.7.  Compiling and Running the Synchronous Model

The complete program is compiled from the top level make file. Both a standalone program (simple-soc) and a libtool compliant library (libsimple-soc.la) are created, and both incorporate the library created when building the logger test (see Section 5.6). The library provides a convenient mechanism for reusing the code from this model, when creating subsequent models which used derived classes.

The Or1ksim configuration is also unchanged. Like the logger, the UART registers start at address 0x90000000 and are a total of 8 bytes in length.

Running the model requires specifying the configuration file (unchanged) and the binary executable (this time the UART loop back program). Assuming the programs have been built in a directory named build, the following command line is suitable.

.build/sysc-models/sync-soc simple.cfg progs_or32/uart-loop
	

Once again the xterm terminal should appear. Select it and type some characters. The window running the model, will show the logged output from the terminal, reporting the same characters being written and timing of the reads and writes. However this time, the time progresses as the characters are written, as shown in Figure 8.3.

$ .build/sysc-models/sync-soc simple.cfg progs_or32/uart-loop

             SystemC 2.2.0 --- May 16 2008 10:30:46
        Copyright (c) 1996-2006 by all Contributors
                    ALL RIGHTS RESERVED

   ... <Or1ksim initialization messages>

Char F read at  415740466667 ps
Read: 'F'
Char written at 416796660 ns
Char a read at  451075036667 ps
Read: 'a'
Char written at 452131230 ns
Char r read at  516688386667 ps
Read: 'r'
Char written at 517744580 ns

   ... <Lots more output>
	  

Figure 8.3.  UART loop back program log output.


The read timing is as the character leaves the terminal, after the terminal has added the baud rate delay. The write timing is as the character leaves the UART after the echo loop in the embedded application on the Or1ksim ISS and after the UART has added the baud-rate delay. So the timing from the read message to the write message should be the time for the UART delay for the current baud rate and packet bits, plus the execution time for the code to echo the character on the Or1ksim ISS.

The UART was initialized to use 1 start bit, 8 data bits and 1 stop bit, which at 9600 baud takes around 1040μs. The time shown in Figure 8.3 for the first character to be read and written back is approximately 1056μs. This seems reasonable, allowing approximately 1600 cycles (16μs at 100MHz) for the Or1ksim ISS to process the read and write code.

Embecosm divider strip