public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Need help at writing basic igen simulator
@ 2004-09-15  9:37 Monika Chaddha
  0 siblings, 0 replies; 5+ messages in thread
From: Monika Chaddha @ 2004-09-15  9:37 UTC (permalink / raw)
  To: david.voit; +Cc: gdb

[-- Attachment #1: Type: text/plain, Size: 1987 bytes --]


Hello,

Please find the attached text doc which contains two mails which I had
sent earlier regarding simulator generator IGEN. These mails can help to
make understanding about '*.igen' files and how they used to implement
the instructions.

Regards
Monika


>-----Original Message-----
>From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com] On
>Behalf Of David Voit
>Sent: Wednesday, September 15, 2004 2:34 AM
>To: gdb@sources.redhat.com
>Subject: Need help at writing basic igen simulator
>
>Hello everybody,
>
>I writed a simple igen file and want to test it now. So I tried to
>integrate it with the existing v850 sourcecode (this looked the
simplest
>of all igen sims) but I find it still to complex for my needs. And now
I
>want to ask if somebody has tried the same and has a base for a simple
>igen simulator which dont need to do much but execute the instructions
in
>the igen file.
>
>I dont need:
>
>- Any sort of memory handling
>- Interupts
>- or any other complicated things
>
>I just want, in the begining, write a template for all MMIX
instructions.
>
>Here is the very very simple igen file at the moment:
>
>:model:::mmix:mmix:
>
>:internal::::illegal:
>{
>  sim_io_eprintf (SD, "Illegal instruction at address 0x%lx\n",
>		  (unsigned long) cia);
>  sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGILL);
>}
>
>11100011,8.reg,16.value::::setl
>"setl reg, value"
>{
>	/* TODO */
>}
>
>00100000,8.reg1,8.reg2,8.reg3::::add
>"add reg1, reg2, reg3"
>{
>	/* TODO */
>}
>
>00011000,8.reg1,8.reg2,8.reg3::::mul
>"mul reg1, reg2, reg3"
>{
>	/* TODO */
>}
>
>00100100,8.reg1,8.reg2,8.reg3::::sub
>"sub reg1, reg2, reg3"
>{
>	/* TODO */
>}
>
>00011100,8.reg1,8.reg2,8.reg3::::div
>"div reg1, reg2, reg3"
>{
>	/* TODO */
>}
>
>ps.:
>
>If i write the instruction identifer in hexform like this
>"8.0xe3,8.reg,16.value::::setl" igen fails with "ld-insn.c:293:
assertion
>failed - word->first->last < 0" it this the correct behavior.
>
>Thanks David


[-- Attachment #2: igen.txt --]
[-- Type: text/plain, Size: 5278 bytes --]


-----Original Message-----
From: gdb-owner@sources.redhat.com [mailto:gdb-owner@sources.redhat.com] On Behalf Of Monika Chaddha
Sent: Thursday, July 22, 2004 12:42 PM
To: 'Xinan Tang'
Cc: gdb@sources.redhat.com
Subject: RE: "igen vs. cgen?"

Hi Xinan

Igen would be used for adding new simulator input. There are many igen
files present in the source... Mips.igen, M16.igen etc...

The source for 'igen' (the simulator generator used) is present at
'src/sim/igen'. The 'igen' simulator generator takes input the mips.igen
file which includes other igen files and generates the simulator source.


The source for simulator will generate in build directory. The contents
of this source will depend on the input 'mips.igen' file. These files
are responsible for instruction implementation.

U need new model name also to add any new instruction.

Monika


>-----Original Message-----
>From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com] On
>Behalf Of Xinan Tang
>Sent: Thursday, July 22, 2004 12:46 AM
>To: gdb@sources.redhat.com
>Subject: "igen vs. cgen?"
>
>Hi
>
>  When I search the gdb mailing list for adding a new simulator, two
>approaches were mentioned: igen vs. cgen.
>
>  Now igen (psim) was included within gdb, is there any consensus which
one
>should be used within gdb for adding a new simulator?
>
>Thanks
>
>--Xinan

=====================================================================================================

-----Original Message-----
From: gdb-owner@sources.redhat.com [mailto:gdb-owner@sources.redhat.com] On Behalf Of Monika Chaddha
Sent: Friday, July 23, 2004 11:12 AM
To: 'Xinan Tang'
Cc: gdb@sources.redhat.com
Subject: RE: "igen vs. cgen?"

Yes.... you will not find any specific document.

I can provide u some idea ... if it helps u
I'll take one example and try to explain u.

000000,5.RS,5.RT,5.RD,00000,100000:SPECIAL:32::ADD
"add r<RD>, r<RS>, r<RT>"
*mipsI:
*mipsII:
*mipsIII:
*mipsIV:
*mipsV:
*mips32:
*mips64:
*vr4100:
*vr5000:
*r3900:
{
------
------
}
The above is existing code for add instruction in mips.igen. You want
that this instruction should be supported by your architecture.

Firstly you need to change configuration files. Firstly add your
architecture based information in configure files in main directory and
sim directory

Example: /src/sim/mips/configure

For mipsisa32 the configuration information is as follows

mipsisa32*-*-*)	sim_gen=IGEN
			sim_igen_machine="-M mips32"
			sim_igen_filter="32,f"
			sim_mach_default="mipsisa32"
			;;

Here sim_gen is simulator generator
Sim_igen_machine will work as a model name ie for mipisa32 the model
name is mips32.
sim_igen_filter is size of instructions
sim_mach_defult is for bfd.

You also define ur architecture. Put yours entry wherever needed in the
configuration files.

Suppose u have defined as followes for architecture xyz

xyz*-*-*)		sim_gen=IGEN
			sim_igen_machine="-M xyz"
			sim_igen_filter="32,f"
			sim_mach_default="mipsisa32"
			;;

Also add this target name in the configuration files in the main
directory
If you want add instruction to be support by ur architecture "xyz"
Than put ur architecture name in the model list as follows

000000,5.RS,5.RT,5.RD,00000,100000:SPECIAL:32::ADD
"add r<RD>, r<RS>, r<RT>"
*mipsI:
*mipsII:
*mipsIII:
*mipsIV:
*mipsV:
*mips32:
*mips64:
*vr4100:
*vr5000:
*r3900:
*xyz: (new architecture)
{
------
------
}

Now if u build gdb for "xyz", this "ADD" instruction will be
supported.If u don't want to support this instruction ... remove ur
model name from here.


Regards
Monika
>-----Original Message-----
>From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com] On
>Behalf Of Xinan Tang
>Sent: Friday, July 23, 2004 12:23 AM
>To: Monika Chaddha
>Cc: gdb@sources.redhat.com
>Subject: RE: "igen vs. cgen?"
>
>Hi Monika,
>
>  Thanks for the reply.
>
>  Is there doc. showing any examples on how to add a new instruction or
>disable some existing ones based on existing *.igen files?
>
>  I googled the web and only found a few pages from psim online manual.
>However it does not provide enough details.
>
>Thanks
>
>--Xinan
>
>-----Original Message-----
>From: gdb-owner@sources.redhat.com
>[mailto:gdb-owner@sources.redhat.com]On Behalf Of Monika Chaddha
>Sent: Wednesday, July 21, 2004 11:12 PM
>To: 'Xinan Tang'
>Cc: gdb@sources.redhat.com
>Subject: RE: "igen vs. cgen?"
>
>
>Hi Xinan
>
>Igen would be used for adding new simulator input. There are many igen
>files present in the source... Mips.igen, M16.igen etc...
>
>The source for 'igen' (the simulator generator used) is present at
>'src/sim/igen'. The 'igen' simulator generator takes input the
mips.igen
>file which includes other igen files and generates the simulator
source.
>
>
>The source for simulator will generate in build directory. The contents
>of this source will depend on the input 'mips.igen' file. These files
>are responsible for instruction implementation.
>
>U need new model name also to add any new instruction.
>
>Monika
>


___________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help at writing basic igen simulator
       [not found] ` <005001c49aef$eb8cf000$5100a8c0@monika>
@ 2004-09-15 19:43   ` David Voit
  0 siblings, 0 replies; 5+ messages in thread
From: David Voit @ 2004-09-15 19:43 UTC (permalink / raw)
  To: Monika Chaddha; +Cc: gdb

Thanks. I already read this in the archive. My problem is not the igen
file but everything around it : ).

David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help at writing basic igen simulator
  2004-09-14 22:12 ` Andrew Cagney
@ 2004-09-15 19:41   ` David Voit
  0 siblings, 0 replies; 5+ messages in thread
From: David Voit @ 2004-09-15 19:41 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On Tue, 14 Sep 2004 18:10:37 -0400, Andrew Cagney <cagney@gnu.org> wrote:
> If you leave this out:
> 
> > {
> >       /* TODO */
> > }
> 
> igen should automatically generate code to throw an unimplemented
> instruction exception.
>

Thats why it is there :). I want to first write the skeleton for a
simulator before doing the actually simulator work.
 
> > If i write the instruction identifer in hexform like this
> > "8.0xe3,8.reg,16.value::::setl" igen fails with "ld-insn.c:293: assertion
> > failed - word->first->last < 0" it this the correct behavior.
> 
> Hmm, forgotten that it was possible to specify hex values.  Looking at
> the mn10300, I think you need:
> 
> :option:::insn-specifying-widths:true

I look at this.

> I've not tried to bring up an IGEN simulator from scratch for some years
> - the onces I worked on were rewrites of existing hand written simulators.

Thanks for your fast answer. I now try to strip my code (v850 copy)
down to a minimum.

David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help at writing basic igen simulator
  2004-09-14 21:30 David Voit
@ 2004-09-14 22:12 ` Andrew Cagney
  2004-09-15 19:41   ` David Voit
       [not found] ` <005001c49aef$eb8cf000$5100a8c0@monika>
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-09-14 22:12 UTC (permalink / raw)
  To: David Voit; +Cc: gdb

If you leave this out:

> {
> 	/* TODO */
> }

igen should automatically generate code to throw an unimplemented 
instruction exception.

> If i write the instruction identifer in hexform like this
> "8.0xe3,8.reg,16.value::::setl" igen fails with "ld-insn.c:293: assertion
> failed - word->first->last < 0" it this the correct behavior.

Hmm, forgotten that it was possible to specify hex values.  Looking at 
the mn10300, I think you need:

:option:::insn-specifying-widths:true

I've not tried to bring up an IGEN simulator from scratch for some years 
- the onces I worked on were rewrites of existing hand written simulators.

Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Need help at writing basic igen simulator
@ 2004-09-14 21:30 David Voit
  2004-09-14 22:12 ` Andrew Cagney
       [not found] ` <005001c49aef$eb8cf000$5100a8c0@monika>
  0 siblings, 2 replies; 5+ messages in thread
From: David Voit @ 2004-09-14 21:30 UTC (permalink / raw)
  To: gdb

Hello everybody,

I writed a simple igen file and want to test it now. So I tried to
integrate it with the existing v850 sourcecode (this looked the simplest
of all igen sims) but I find it still to complex for my needs. And now I
want to ask if somebody has tried the same and has a base for a simple
igen simulator which dont need to do much but execute the instructions in
the igen file.

I dont need:

- Any sort of memory handling
- Interupts
- or any other complicated things

I just want, in the begining, write a template for all MMIX instructions.

Here is the very very simple igen file at the moment:

:model:::mmix:mmix:

:internal::::illegal:
{
  sim_io_eprintf (SD, "Illegal instruction at address 0x%lx\n",
		  (unsigned long) cia);
  sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGILL);
}

11100011,8.reg,16.value::::setl
"setl reg, value"
{
	/* TODO */
}

00100000,8.reg1,8.reg2,8.reg3::::add
"add reg1, reg2, reg3"
{
	/* TODO */
}

00011000,8.reg1,8.reg2,8.reg3::::mul
"mul reg1, reg2, reg3"
{
	/* TODO */
}

00100100,8.reg1,8.reg2,8.reg3::::sub
"sub reg1, reg2, reg3"
{
	/* TODO */
}

00011100,8.reg1,8.reg2,8.reg3::::div
"div reg1, reg2, reg3"
{
	/* TODO */
}

ps.:

If i write the instruction identifer in hexform like this
"8.0xe3,8.reg,16.value::::setl" igen fails with "ld-insn.c:293: assertion
failed - word->first->last < 0" it this the correct behavior.

Thanks David

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-09-15 19:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-15  9:37 Need help at writing basic igen simulator Monika Chaddha
  -- strict thread matches above, loose matches on Subject: below --
2004-09-14 21:30 David Voit
2004-09-14 22:12 ` Andrew Cagney
2004-09-15 19:41   ` David Voit
     [not found] ` <005001c49aef$eb8cf000$5100a8c0@monika>
2004-09-15 19:43   ` David Voit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).