srecord: srecord::input_file_logisim Class Reference

srecord 1.65.0

Loading...
Searching...
No Matches
srecord::input_file_logisim Class Reference

The input_file_logisim class is used to represent the processing required to parse Logisim rom data files. More...

`#include <logisim.h>`

Inheritance diagram for srecord::input_file_logisim:
[legend]
Collaboration diagram for srecord::input_file_logisim:
[legend]

## Public Types
enum | state_t { state_line_one , state_line_two , state_lines_of_data }
Public Types inherited from srecord::input_file
typedef std::shared_ptr< input_file > | pointer
Public Types inherited from srecord::input
typedef std::shared_ptr< input > | pointer

## Public Member Functions
virtual | ~input_file_logisim ()
| The destructor.
Public Member Functions inherited from srecord::input_file
virtual | ~input_file ()
| The destructor.
Public Member Functions inherited from srecord::input
virtual | ~input ()
| The destructor.
virtual void | fatal_error (const char *,...) const FORMAT_PRINTF(2
| The fatal_error method is used to report problems parsing the file.
virtual void virtual void | fatal_error_errno (const char *,...) const FORMAT_PRINTF(2
| The fatal_error_errno method is used to report problems reading the input file.
virtual void virtual void virtual void | warning (const char *,...) const FORMAT_PRINTF(2
| The warning method is used to report potential (but non-fatal) problems parsing the file.
void | set_quit (quit &)
| The set_quit method is used to set the disposition of the error messages, and the "exit" implementation.
void | reset_quit (void)
| The reset_quit method is used to cause the disposition of the error messages, and the "exit" back to the default.
virtual void | command_line (srecord::arglex_tool *cmdln)
| The command_line method is used by arglex_srec::get_input when parsing the command line, to give a format or filter an opportunity to grab extra arguments off the command line.

## Static Public Member Functions
static input_file::pointer | create (const std::string &file_name)
Static Public Member Functions inherited from srecord::input_file
static pointer | guess (const std::string &file_name, arglex &cmdln)
| The guess class method is used to open a file of an unknown type.
static void | ignore_all_checksums (void)
| The ignore_all_checksums method is used to set the global ignore checksums flag.

## Protected Member Functions
bool | read (srecord::record &rec)
| The read method is used to read one record from the input.
const char * | get_file_format_name (void) const
| The get_file_format_name method is used to find out the name of the file format being read.
int | format_option_number (void) const
| The format_option_number method is used to obtain the option number, which can then be turned into text via the arglex::token_name method.
| input_file_logisim (const std::string &file_name)
| The constructor.
Protected Member Functions inherited from srecord::input_file
virtual std::string | filename (void) const
| The filename method is used to get the name of the input file being processed.
virtual std::string | filename_and_line (void) const
| The filename_and_line method is used to get the name and current line number within the file.
void | disable_checksum_validation (void)
| The disable_checksum_validation method is used to have this input stream ignore checksum errors.
| input_file (const std::string &file_name)
| The constructor.
virtual int | get_char (void)
| The get_char method is used to fetch a character from the input.
virtual void | get_char_undo (int)
| The get_char_undo method is used to return a character to the input.
int | peek_char (void)
| The peek_char method is used to look at the next character of input, without actually consuming it (a later get_char or peak_char method will still see it).
virtual int | get_nibble (void)
| The get_nibble method is used to fetch one hexadecimal digit from the input, via the get_char method.
virtual int | get_byte (void)
| The get_byte method is used to fetch a byte value from the input.
unsigned | get_word_be (void)
| The get_word_be method is used to fetch a 16-bit value from the input.
unsigned | get_word_le (void)
| The get_word_le method is used to fetch a 16-bit value from the input.
unsigned long | get_3bytes_be (void)
| The get_3bytes_be method is used to fetch a 24-bit value from the input.
unsigned long | get_3bytes_le (void)
| The get_3bytes_le method is used to fetch a 24-bit value from the input.
unsigned long | get_4bytes_be (void)
| The get_4bytes_be method is used to fetch a 32-bit value from the input.
unsigned long | get_4bytes_le (void)
| The get_4bytes_le method is used to fetch a 32-bit value from the input.
int | checksum_get (void) const
| The checksum_get method is used to get the current value of the running checksum (added to by the checksum_add method, usually called by the get_byte method).
int | checksum_get16 (void) const
| The checksum_get16 method is used to get the current value of the running checksum (added to by the checksum_add method, usually called by the get_byte method).
virtual void | checksum_add (unsigned char n)
| The checksum_add method is used to add another 8-bit value to the running checksum.
void | checksum_reset (void)
| The checksum_rest method is used to set the running checksum to zero.
void | seek_to_end (void)
| The seek_to_end method is used to move the input position to the end of the file.
virtual bool | is_binary (void) const
| The is_binary method is used to to determine whether or not a file format is binary (true) of text (false).
bool | use_checksums (void) const
| The use_checksums method is used to determine whether or not to validate checksums when data is read.
Protected Member Functions inherited from srecord::input
| input ()
| The default constructor.

## Additional Inherited Members
Static Protected Member Functions inherited from srecord::input_file
static int | get_nibble_value (int c)
| The get_nibble_value class method is used to translate a character into its hexadecimal value.
Protected Attributes inherited from srecord::input_file
int | checksum
| The checksum instance variable is used record the running checksum.

## Detailed Description

The input_file_logisim class is used to represent the processing required to parse Logisim rom data files.

http://ozark.hendrix.edu/~burch/logisim/docs/2.3.0/guide/mem/menu.html

Pop-up menus and files

The pop-up menu for memory includes four options in addition to the options common to all components:

Edit Contents: Bring up a hex editor for editing the contents of memory. Clear Contents: Resets all values in memory to 0. Load Image...: Resets all values in memory based on the values found in a file using the format described below. Save Image...: Stores all values in memory into a file using the format described below.

The file format used for image files is intentionally simple; this permits you to write a program, such as an assembler, that generates memory images that can then be loaded into memory. As an example of this file format, if we had a 256-byte memory whose first five bytes were 2, 3, 0, 20, and -1, and all subsequent values were 0, then the image would be the following text file.

v2.0 raw

02 03 00 14 ff

The first line identifies the file format used (currently, there is only one file format recognized). Subsequent values list the values in hexadecimal, starting from address 0; you can place several such values on the same line. Logisim will assume that any values unlisted in the file are zero.

The image file can use run-length encoding; for example, rather than list the value 00 sixteen times in a row, the file can include 16*00 rather than repeat 00 sixteen times. Notice than the number of repetitions is written in base 10. Files produced by Logisim will use run-length encoding for runs of at least four values

Definition at line 80 of file logisim.h.

## Member Enumeration Documentation

## ◆ state_t

enum srecord::input_file_logisim::state_t

Enumerator
state_line_one |
state_line_two |
state_lines_of_data |

Definition at line 91 of file logisim.h.

## Constructor & Destructor Documentation

## ◆ ~input_file_logisim()

virtual srecord::input_file_logisim::~input_file_logisim | ( |  | ) |
| virtual

The destructor.

## ◆ input_file_logisim()

srecord::input_file_logisim::input_file_logisim | ( | const std::string & | file_name | ) |
| protected

The constructor.

## Member Function Documentation

## ◆ create()

input_file::pointer srecord::input_file_logisim::create | ( | const std::string & | file_name | ) |
| static

## ◆ read()

bool srecord::input_file_logisim::read | ( | srecord::record & | rec | ) |
| protectedvirtual

The read method is used to read one record from the input.

It returns 0 at the end of the input, and 1 if a record is read successfully.

See the srecord::record documentation (header file) for details of the various record types.

Note: there is no guarantee that a header record will appear first, or that a execution start address record will appear last.

Parameters

  rec | Where to put the returned data.

Returns
  bool; true if data was read, false if at end-of-file

Implements srecord::input.

## ◆ get_file_format_name()

const char * srecord::input_file_logisim::get_file_format_name | ( | void |  | ) | const
| protectedvirtual

The get_file_format_name method is used to find out the name of the file format being read.

Derived classes must supply this method.

Implements srecord::input.

## ◆ format_option_number()

int srecord::input_file_logisim::format_option_number | ( | void |  | ) | const
| protectedvirtual

The format_option_number method is used to obtain the option number, which can then be turned into text via the arglex::token_name method.

Implements srecord::input_file.

The documentation for this class was generated from the following file:

- input/file/logisim.h