POV-Ray : Newsgroups : povray.off-topic : BPM Server Time
13 Oct 2026 04:49:34 EDT (-0400)
  BPM (Message 51 to 77 of 77)  
<<< Previous 50 Messages Goto Initial 50 Messages
From: Darren New
Subject: Re: New BPM
Date: 9 Jun 2010 12:03:32
Message: <4c0fbb54$1@news.povray.org>
Invisible wrote:
> problem is scheduling a thread to run when I actually want it to run.

So you want to schedule real-time threads on a timesharing OS.

Have you bumped the priority of your own process up? Have you scheduled it 
to wake a few miliseconds early then busy-loop on the actual hardware clock 
until the tick comes? Have you turned off other things that might be 
generating interrupts like disk reads?

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Mike Raiford
Subject: Re: Microcode
Date: 9 Jun 2010 13:19:48
Message: <4c0fcd34$1@news.povray.org>
On 6/9/2010 9:39 AM, Invisible wrote:

> Note also that the 6502 doesn't have any microcode. It just uses a PLA
> as the control matrix - much like the processor that I'm designing. ;-)

How many instructions are you going to have? Or are you using an IC? You 
still have to map the control signals to the op code ;) That's the part 
that was giving me fits to debug (though, I'm holding off while I work 
on my simulator program, for a while ...)

-- 
~Mike


Post a reply to this message

From: Darren New
Subject: Re: Microcode
Date: 9 Jun 2010 14:10:53
Message: <4c0fd92d$1@news.povray.org>
Invisible wrote:
> Note also that the 6502 doesn't have any microcode. 

Given how the instruction sets decoded, I'm not sure it's really valid to 
say it had no microcode. There were definitely cycles of stepping thru the 
code and branching around in the PLA data.  I'm not an expert, but it wasn't 
really hard-wired logic as such. The HCF instruction, for example, was an 
emergent property of the "microcode" interpretation and not something 
necessarily intentional.

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: scott
Subject: Re: New BPM
Date: 10 Jun 2010 03:14:26
Message: <4c1090d2$1@news.povray.org>
> "Retrieves the current value of the high-resolution performance counter."
>
> From what little documentation there is, it seems this allows me to 
> measure wall-time, really accurately. Which isn't the problem - the 
> problem is scheduling a thread to run when I actually want it to run.

Well just start it at roughly the right time and have the thread loop until 
it's exactly the correct time.


Post a reply to this message

From: Invisible
Subject: Re: Microcode
Date: 10 Jun 2010 04:12:13
Message: <4c109e5d$1@news.povray.org>
Darren New wrote:
> Invisible wrote:
>> Note also that the 6502 doesn't have any microcode. 
> 
> Given how the instruction sets decoded, I'm not sure it's really valid 
> to say it had no microcode.

And you actually know how it was wired up internally, do you?


Post a reply to this message

From: Invisible
Subject: Re: New BPM
Date: 10 Jun 2010 04:17:23
Message: <4c109f93$1@news.povray.org>
>> problem is scheduling a thread to run when I actually want it to run.
> 
> So you want to schedule real-time threads on a timesharing OS.
> 
> Have you bumped the priority of your own process up? Have you scheduled 
> it to wake a few miliseconds early then busy-loop on the actual hardware 
> clock until the tick comes? Have you turned off other things that might 
> be generating interrupts like disk reads?

My measurements indicate that the interval between ticks is rock solidly 
constant - it's just the *wrong* interval. (It's too large.)

I believe the problem is that the library won't let me specify an 
absolute time, only relative times. So if I was "wait 100 ms", but the 
other processing that the program does takes 1 ms, the delay ends up 
being 101 ms, not 100 ms. The fact that taking stuff out of the main 
loop made the timings nearer to what they should be supports this 
hypothesis. (Although it's always possible that the problem is related 
to the size of the quantum that Haskell's thread scheduler is using or 
something daft like that.)

Still, since no other API is available, there's not much I can do about 
it. (Other than whinge at the developers and see if it gets fixed in the 
next release of the library...)


Post a reply to this message

From: Invisible
Subject: Re: New BPM
Date: 10 Jun 2010 04:18:27
Message: <4c109fd3$1@news.povray.org>
scott wrote:

> Well just start it at roughly the right time and have the thread loop 
> until it's exactly the correct time.

I'm not keen on burning shedloads of CPU power just because of a 
deficiency in the thread library. But we'll see...


Post a reply to this message

From: scott
Subject: Re: New BPM
Date: 10 Jun 2010 04:33:39
Message: <4c10a363$1@news.povray.org>
>> Well just start it at roughly the right time and have the thread loop 
>> until it's exactly the correct time.
>
> I'm not keen on burning shedloads of CPU power just because of a 
> deficiency in the thread library. But we'll see...

Well issue a sleep command at the top until you are roughly at the correct 
time, then loop until you are exactly there.  You shouldn't be burning more 
than 0.1 or 0.2% CPU this way.


Post a reply to this message

From: Darren New
Subject: Re: Microcode
Date: 10 Jun 2010 12:00:41
Message: <4c110c29$1@news.povray.org>
Invisible wrote:
> Darren New wrote:
>> Invisible wrote:
>>> Note also that the 6502 doesn't have any microcode. 
>>
>> Given how the instruction sets decoded, I'm not sure it's really valid 
>> to say it had no microcode.
> 
> And you actually know how it was wired up internally, do you?

Yes. There was a very interesting article on it showing how it worked, 
somewhere.  I'll see if I can find it.

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Darren New
Subject: Re: Microcode
Date: 10 Jun 2010 12:16:26
Message: <4c110fda@news.povray.org>
Invisible wrote:
> And you actually know how it was wired up internally, do you?


http://www.pagetable.com/?p=39

Actually, I'll grant it's not microcode per se, but it's a table-driven 
system with a multiple-cycle-per-instruction clock that steps thru the 
table, so now it's an argument more over "what is microcode" than it is over 
whether a 6502 has microcode.

I'd say anything that steps thru a ROM with a counter during one instruction 
is probably microcode, myself.

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Darren New
Subject: Re: New BPM
Date: 10 Jun 2010 12:17:39
Message: <4c111023$1@news.povray.org>
Invisible wrote:
> I believe the problem is that the library won't let me specify an 
> absolute time, only relative times. So if I was "wait 100 ms", but the 
> other processing that the program does takes 1 ms, the delay ends up 
> being 101 ms, not 100 ms.

Well, yeah.

> Still, since no other API is available, there's not much I can do about 
> it. (Other than whinge at the developers and see if it gets fixed in the 
> next release of the library...)

No, you do your processing, then you look at the highest resolution clock 
you have and figure out how much *longer* you have to wait, then you wait. 
Adjusting for the length of time it takes to figure out how much longer you 
have to wait.

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Orchid XP v8
Subject: Re: Microcode
Date: 10 Jun 2010 13:25:04
Message: <4c111ff0$1@news.povray.org>
>> And you actually know how it was wired up internally, do you?
> 
> http://www.pagetable.com/?p=39

...Christ that's complicated! o_O

> so now it's an argument more over "what is microcode" than it is 
> over whether a 6502 has microcode.

Yeah, well, that figures. ;-)

> I'd say anything that steps thru a ROM with a counter during one 
> instruction is probably microcode, myself.

Well, a "ROM" can be just a grid of wires, some connected and some not.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Orchid XP v8
Subject: Re: New BPM
Date: 10 Jun 2010 13:25:51
Message: <4c11201f$1@news.povray.org>
>> Still, since no other API is available, there's not much I can do 
>> about it. (Other than whinge at the developers and see if it gets 
>> fixed in the next release of the library...)
> 
> No, you do your processing, then you look at the highest resolution 
> clock you have and figure out how much *longer* you have to wait, then 
> you wait. Adjusting for the length of time it takes to figure out how 
> much longer you have to wait.

Except that figuring out how long you need to wait would *itself* take 
time...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Darren New
Subject: Re: Microcode
Date: 10 Jun 2010 14:39:27
Message: <4c11315f@news.povray.org>
Orchid XP v8 wrote:
> Well, a "ROM" can be just a grid of wires, some connected and some not.

Yes?  I was saying something with a program counter that runs mulitple 
instructions per CPU instruction would count as microcode, regardless of how 
you stored the code it's running.

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Darren New
Subject: Re: New BPM
Date: 10 Jun 2010 14:39:53
Message: <4c113179$1@news.povray.org>
Orchid XP v8 wrote:
>>> Still, since no other API is available, there's not much I can do 
>>> about it. (Other than whinge at the developers and see if it gets 
>>> fixed in the next release of the library...)
>>
>> No, you do your processing, then you look at the highest resolution 
>> clock you have and figure out how much *longer* you have to wait, then 
>> you wait. Adjusting for the length of time it takes to figure out how 
>> much longer you have to wait.
> 
> Except that figuring out how long you need to wait would *itself* take 
> time...

You missed the second sentence of the two-sentence paragraph, didn't you?

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Darren New
Subject: Re: New BPM
Date: 10 Jun 2010 15:15:45
Message: <4c1139e1$1@news.povray.org>
Orchid XP v8 wrote:
> Except that figuring out how long you need to wait would *itself* take 
> time...

Here's another funny thing:

In CDMA cell phones (at least), not only do they have to figure out how long 
they have to wait, they have to keep track of how long different parts of 
the chip have been turned on, to compensate for the fact that the crystal 
will vibrate at different speeds depending on how warm it is. So if you have 
to read two packets before turning off, you have to plan to wake up slightly 
later than if you only read one packet before you turned off, because the 
chip will be running warmer and faster.

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Invisible
Subject: Re: Microcode
Date: 11 Jun 2010 04:00:19
Message: <4c11ed13$1@news.povray.org>
>> Well, a "ROM" can be just a grid of wires, some connected and some not.
> 
> Yes?  I was saying something with a program counter that runs mulitple 
> instructions per CPU instruction would count as microcode, regardless of 
> how you stored the code it's running.

So if it doesn't use a counter it's not microcode?

As you say, we're just arguing about semantics now. I always thought of 
microcode as being a block of ROM (or even some kind of EPROM) which 
actual address decode circuitry, so that you can execute jumps and so 
forth. By contrast, the CPU I'm designing has no such thing. It's just 
that on each clock pulse, a different control line becomes active, and 
that line connects to one or more control lines (possibly via logic 
gates that pass the signal only if the opcode has certain bits set). I 
wouldn't call that microcode; it'd call that "a custom arrangement of 
gates".


Post a reply to this message

From: Invisible
Subject: Re: New BPM
Date: 11 Jun 2010 04:02:09
Message: <4c11ed81$1@news.povray.org>
>>> No, you do your processing, then you look at the highest resolution 
>>> clock you have and figure out how much *longer* you have to wait, 
>>> then you wait. Adjusting for the length of time it takes to figure 
>>> out how much longer you have to wait.
>>
>> Except that figuring out how long you need to wait would *itself* take 
>> time...
> 
> You missed the second sentence of the two-sentence paragraph, didn't you?

No, I failed to comprehend it.

Even so, I'd suggest that it's more or less infeasible to determine how 
long a calculation takes.

Either way, this would be *so much* easier if I could ask for absolute 
rather than relative start times...

(I also love the way the internal implementation look like it's likely 
to fail if you call threadDelay just before midnight... That's a nice 
touch.)


Post a reply to this message

From: Mike Raiford
Subject: Re: Microcode
Date: 11 Jun 2010 08:47:40
Message: <4c12306c$1@news.povray.org>
On 6/11/2010 3:00 AM, Invisible wrote:

>
> As you say, we're just arguing about semantics now. I always thought of
> microcode as being a block of ROM (or even some kind of EPROM) which
> actual address decode circuitry, so that you can execute jumps and so
> forth. By contrast, the CPU I'm designing has no such thing. It's just
> that on each clock pulse, a different control line becomes active, and
> that line connects to one or more control lines (possibly via logic
> gates that pass the signal only if the opcode has certain bits set). I
> wouldn't call that microcode; it'd call that "a custom arrangement of
> gates".

I might be wrong, but my definition of microcode is thus:

A sequence of one or more control signal sets configured to execute the 
desired instruction. On mine, for example, the microcode rom is 
basically a big LUT allowing for 16 microcode steps each instruction, 
since an instruction can have more than one phase:

For example

ld a, [si]

decodes to a series of instructions:

output the contents of si to the address latches
fetch the memory word from that location and store it in the register a
fetch next instruction

(The second can be done is a single step, due to the mux/dmux pair that 
allows most registers or busses to be connected to other registers or 
busses)





-- 
~Mike


Post a reply to this message

From: Darren New
Subject: Re: Microcode
Date: 11 Jun 2010 12:35:33
Message: <4c1265d5$1@news.povray.org>
Invisible wrote:
>>> Well, a "ROM" can be just a grid of wires, some connected and some not.
>>
>> Yes?  I was saying something with a program counter that runs mulitple 
>> instructions per CPU instruction would count as microcode, regardless 
>> of how you stored the code it's running.
> 
> So if it doesn't use a counter it's not microcode?

That's just *my* definition. If it doesn't have something serving as a 
program counter, I wouldn't classify it as "code" instead of "logic". In the 
case of the 6502, it's pretty clear that the T1 thru T6 lines act as a 
program counter, and the other bits are acting as the code.

> As you say, we're just arguing about semantics now. I always thought of 
> microcode as being a block of ROM (or even some kind of EPROM) which 
> actual address decode circuitry, so that you can execute jumps and so 
> forth. 

Basically. And normally its instructions are wide enough to have one bit per 
gating signal inside the CPU (so, a line for "register 1 reads bus", a line 
for "register 2 writes bus" a line for "R3 writes to address bus" a line for 
"PC reads from data bus", along with selecting the proper ALU unit, etc. So 
microcode is not uncommonly 100's of bits wide. And it usually has the new 
Micro-PC in each instruction too, so every instruction is a branch.

 > By contrast, the CPU I'm designing has no such thing. It's just
> that on each clock pulse, a different control line becomes active, and 
> that line connects to one or more control lines (possibly via logic 
> gates that pass the signal only if the opcode has certain bits set). I 
> wouldn't call that microcode; it'd call that "a custom arrangement of 
> gates".

I agree. There's no code there. You have hardwired logic.

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Darren New
Subject: Re: Microcode
Date: 11 Jun 2010 12:41:58
Message: <4c126756$1@news.povray.org>
Mike Raiford wrote:
> A sequence of one or more control signal sets configured to execute the 
> desired instruction. 

I guess, depending on how you define "control signal sets" and "configured" 
and "sequence", sure.  *I* consider it microcode if the configuration is ROM 
instead of hardwired logic, and "sequence" implies having something 
counter-like to sequence it.

The idea being that all you need to change what instructions a microcoded 
CPU supprts is to change the ROM itself without rewiring other gates.

People used to build computers that would load different microcode depending 
on the program you were running. The first Smalltalk machines had a 
Smalltalk microcode set, so there weren't any "primitives" - the CPU ran 
Smalltalk code directly. Other machines could switch between FORTRAN and 
COBOL microcode.  The original 8" floppies were designed to hold the 
microcode for those mainframes.


> n mine, for example, the microcode rom is 
> basically a big LUT allowing for 16 microcode steps each instruction, 
> since an instruction can have more than one phase:

And how do you step thru those instructions?  A program counter type thing? 
Then it's likely microcode in my book. :-)

Don't think I'm trying to be authoritative on this one.  There's probably 
some actual official definition out there that's relatively arbitrary due to 
things on the edge of the definition.

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Darren New
Subject: Re: New BPM
Date: 11 Jun 2010 12:44:23
Message: <4c1267e7$1@news.povray.org>
Invisible wrote:
> Even so, I'd suggest that it's more or less infeasible to determine how 
> long a calculation takes.

Nonsense. People do it all the time.  If nothing else, do it by 
experimentation. Try sleeping one milisecond using the technique, measure 
how fast the clock goes, and adjust. You can even adjust dynamically based 
on when you wake up. If you wake up 29 microseconds later than you asked, 
subtract 29 microseconds the next time.

> Either way, this would be *so much* easier if I could ask for absolute 
> rather than relative start times...

Read the absolute time, subtract it from the time you want to wake up, 
subtract the length of time you were late last time, and sleep that long. 
When you wake up, read the absolute time, subtract it from the time you 
wanted to wake up, and store that for the next cycle.

> (I also love the way the internal implementation look like it's likely 
> to fail if you call threadDelay just before midnight... That's a nice 
> touch.)

What system are you looking at?

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Mike Raiford
Subject: Re: Microcode
Date: 11 Jun 2010 13:20:00
Message: <4c127040@news.povray.org>
On 6/11/2010 11:41 AM, Darren New wrote:

>
> And how do you step thru those instructions? A program counter type
> thing? Then it's likely microcode in my book. :-)
>

well, of course there's some sort of counter. Else how would it work? ;)


> Don't think I'm trying to be authoritative on this one. There's probably
> some actual official definition out there that's relatively arbitrary
> due to things on the edge of the definition.
>

I'm sure there is ... But I don't necessarily think it has to be ROM, 
per se, it could be a gate array...


-- 
~Mike


Post a reply to this message

From: Darren New
Subject: Re: Microcode
Date: 11 Jun 2010 13:37:47
Message: <4c12746b$1@news.povray.org>
Mike Raiford wrote:
> well, of course there's some sort of counter. Else how would it work? ;)

That's what I'm saying. It *is* possible to design logic that doesn't have a 
counter like that.

> I'm sure there is ... But I don't necessarily think it has to be ROM, 
> per se, it could be a gate array...

Anything that works like a ROM where all you need to do is change *that* 
part to have a new instruction set would do. Whether your ROM is implemented 
with wires or gates doesn't matter that much to me.

-- 
Darren New, San Diego CA, USA (PST)
    Eiffel - The language that lets you specify exactly
    that the code does what you think it does, even if
    it doesn't do what you wanted.


Post a reply to this message

From: Orchid XP v8
Subject: Re: Microcode
Date: 12 Jun 2010 04:57:01
Message: <4c134bdd$1@news.povray.org>
Darren New wrote:

>> By contrast, the CPU I'm designing has no such thing.
> 
> I agree. There's no code there. You have hardwired logic.

It seems we are in agreement then.

(I'm actually wondering if microcode would have been easier though...!)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Orchid XP v8
Subject: Re: New BPM
Date: 12 Jun 2010 06:04:11
Message: <4c135b9b$1@news.povray.org>
Darren New wrote:

> What system are you looking at?

The GHC threading library.

The source code looks like it does a POSIX "get time of day" call, and 
then uses the "microseconds past midnight" field to determine when the 
schedule the wakeup call.

It strikes me that if between now and the intended wakeup time the clock 
wraps past midnight, things are going to go wrong. But maybe I'm mistaken...

I'm also not sure if the same thing happens under Windows. It's kinda 
tricky to follow all the CPP directives.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Orchid XP v8
Subject: Scientific experiments
Date: 12 Jun 2010 14:43:38
Message: <4c13d55a$1@news.povray.org>
Right. So I just fired up Cubase, imported an audio track, dialed in the 
BPM I found from that website, and listened to the click track against 
the recording.

Except for some phase-alignment problems, and the click track gradually 
going out of phase, the BPM readings I had were very, very close to 
being correct. Close enough that it's difficult to figure out whether 
they're too high or too low.

In other words, the trivial algorithm the website uses already produces 
really very accurate measurements. Nothing to fix here. (Unless you 
actually wanted beat-perfect matching, rather than a general estimate of 
speed...)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

<<< Previous 50 Messages Goto Initial 50 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.