simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] initial patch for interrupt flag/enable bits


From: Theodore A. Roth
Subject: Re: [Simulavr-devel] initial patch for interrupt flag/enable bits
Date: Thu, 20 Nov 2003 14:47:05 -0800 (PST)


On Thu, 20 Nov 2003, John Regehr wrote:

> I'm attaching a patch that adds interrupt flag and enable bits to the
> ATmega16 specification.  Let me know if this looks good and I'll do more.
>
> The patched simulator should run as before; the extra information won't be
> useful until other code is hacked.

Wouldn't it be more efficient to pass a bit mask instead of the bit
position? Then the check becomes (psuedo code):

  if ((sreg & SREG_I) && (read_io_reg(addr) & bitMask))
    ...

instead of this:

  if ((sreg & SREG_I) && (read_io_reg(addr) & (1 << bit)))
    ...

Are you planning on needing the bit position else where?

One nitpick. I'm trying to keep new to code to less than 80 chars. I'd
rather see this:

!     .INT0           = { "IRQ_INT0",         0x02,    0x00, { 0x5b, 6 }, { 
0x5a, 6 } },

written as this:

!     .INT0           = { "IRQ_INT0",
!                         0x02, 0x00, { 0x5b, 6 }, { 0x5a, 6 } },

If don't don't feel like reformatting, I'll do it before committing, but
I'd rather not. ;-)

Other than those, I think I like where this is headed.

Thanks.

Ted Roth




reply via email to

[Prev in Thread] Current Thread [Next in Thread]