This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch][rfa] CGEN Model Support for SID


No comments on this? Too much or too little information?

OK to commit?

Dave

Dave Brolley wrote:

Hi,

This submission cleans up the partially adapted support for CGEN models for SID and enables it. Attached are patches for CGEN and SID which accomplish this:

o sid-model.patch.txt's: Patches for CGEN and SID
o cgen-model.h: New class definition in sid/component/cgen-cpu
o *.ChangeLog: ChangeLogs for the above

Also attached are examples of the generated code and suggested usage for the xstormy16:

o xstormy16-model.{cxx,h}: CGEN-generated model code
o xstormy16-model-gen.patch.txt: Additional code generated into xstormy16-decode.h and xstormy16-sem.cxx
o xstormy16-model.patch.txt: Patch showing suggest usage of the generated code by a SID cgen-cpu.


Notes:

o The implementation is similar to the existing implementation for sim/common simulators except:
- The generated functions are encapsulated into a class: <prefix>_<model>_model
- Functions are generated for modelling each insn both before and after execution. The sim/common implementation only generated a function to be called after execution, however, there was a need for modelling both before and after in the implementaion of the FRV simulator which was handled somewhat awkwardly. Therefore I added this capability for this implementation.
- As in the existing sim/common implementation, there are hooks provided (at the cgen-model level) for modelling before and after groups of parallel insns.


A general outline of the design follows:

o A new class, cgen-model, has been defined in sid/component/cgen-cpu/cgen-model.h. It provides the methods for modelling before and after groups of parallel insns with default virtual implementations and keeps a pointer to the cpu for reporting computed latencies.

o The script sid/component/cgen-cpu/CGEN.sh has been enhanced to process the option 'with-profile=fn' and to generate the files model.cxx and model.h.

o For each model (cgen model) used by a all machines (cgen mach) being generated, a class, @prefix at _@model at _model is generated in sid/component/cgen-cpu/@cpu@/@prefix at -model dot {cxx,h}. These classes each inherit from cgen-cpu and implement the functions for modelling each unit before and after each insn. Default virtual implementations are provided as well as a table mapping each insn to its unit modelling functions and functions for indexing the table to make the calls.

o The generated code, as is, is complete and implements default latency computations as defined by the (timing ...) elements of each insn in the .cpu file.

o Since the default implementations are virtual, the programmer may inherit the generated class(es) to implement more complex modelling behavior for each unit of each model as needed.

o Calls to the modelling functions are inserted, as necessary, into the cpu's step_insns method. See xstormy16-model.patch.txt for an example.

This implementation has been tested on xstormy16 and an internal port which makes extensive use of this new work. Other ports are not affected since they do not make use of this functionality.

I am seeking comments leading toward approval to commit the general changes. I can also commit the xtormy16-specific code if folks think it would be of use as an example.

Dave




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]