Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Chemistry professors never die, they just fail to react.


devel / comp.lang.forth / Jtag and Forth

SubjectAuthor
* Jtag and ForthChristopher Lozinski
`* Re: Jtag and ForthLorem Ipsum
 `* Re: Jtag and ForthChristopher Lozinski
  `* Re: Jtag and ForthLorem Ipsum
   `* Re: Jtag and ForthChristopher Lozinski
    `* Re: Jtag and ForthLorem Ipsum
     `* Re: Jtag and Forthnone
      `* Re: Jtag and ForthMarcel Hendrix
       +- Re: Jtag and ForthAnton Ertl
       `* Re: Jtag and Forthminforth
        +- Re: Jtag and Forthnone
        `- Re: Jtag and ForthGerry Jackson

1
Jtag and Forth

<e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23284&group=comp.lang.forth#23284

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ae9:f719:0:b0:74d:19c8:d9e with SMTP id s25-20020ae9f719000000b0074d19c80d9emr505055qkg.4.1682019473613;
Thu, 20 Apr 2023 12:37:53 -0700 (PDT)
X-Received: by 2002:a05:622a:4313:b0:3ef:2d40:601a with SMTP id
el19-20020a05622a431300b003ef2d40601amr737715qtb.5.1682019473361; Thu, 20 Apr
2023 12:37:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 20 Apr 2023 12:37:53 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=46.134.43.190; posting-account=qOvlJAoAAAALKIuQXXxAY1xxkFpdJUbI
NNTP-Posting-Host: 46.134.43.190
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>
Subject: Jtag and Forth
From: calozin...@gmail.com (Christopher Lozinski)
Injection-Date: Thu, 20 Apr 2023 19:37:53 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1302
 by: Christopher Lozinski - Thu, 20 Apr 2023 19:37 UTC

So now we are learning about JTAG.
I know that the Propeller Parallax used Forth for testing.
Do I need JTAG if I have a Forth cpu on the device?
Do I need JTAG to debug the Forth CPU?
What do I need to be able to single step a Forth CPU, an debug a program.
Sorry to bother, I have a lot to learn.
Thank you.
Chris

Re: Jtag and Forth

<e49fd51b-f429-4351-ad27-e713a74f4cb3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23285&group=comp.lang.forth#23285

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:4f91:0:b0:5ef:41e3:3cba with SMTP id em17-20020ad44f91000000b005ef41e33cbamr503599qvb.3.1682024192429;
Thu, 20 Apr 2023 13:56:32 -0700 (PDT)
X-Received: by 2002:a05:6214:927:b0:5f5:14ef:90ba with SMTP id
dk7-20020a056214092700b005f514ef90bamr492157qvb.2.1682024192080; Thu, 20 Apr
2023 13:56:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 20 Apr 2023 13:56:31 -0700 (PDT)
In-Reply-To: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=198.245.101.90; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 198.245.101.90
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e49fd51b-f429-4351-ad27-e713a74f4cb3n@googlegroups.com>
Subject: Re: Jtag and Forth
From: gnuarm.d...@gmail.com (Lorem Ipsum)
Injection-Date: Thu, 20 Apr 2023 20:56:32 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Lorem Ipsum - Thu, 20 Apr 2023 20:56 UTC

On Thursday, April 20, 2023 at 3:37:54 PM UTC-4, Christopher Lozinski wrote:
> So now we are learning about JTAG.
> I know that the Propeller Parallax used Forth for testing.
> Do I need JTAG if I have a Forth cpu on the device?
> Do I need JTAG to debug the Forth CPU?
> What do I need to be able to single step a Forth CPU, an debug a program.
> Sorry to bother, I have a lot to learn.
> Thank you.
> Chris

Single stepping a Forth program has got to be one of the least effective ways to debug. Most people use REPL, meaning Read, Evaluate, Print Loop. Load the code, execute it and evaluate the results. Do this for every word, as you write it, and you will eliminate most bugs as you write. This presents many fewer bugs as you assemble the pieces of code into larger constructs, which you still debug with REPL.

I have not used a JTAG tool to debug anything in Forth, ever.

BTW, there are no Forth CPUs. When people use the term "Forth CPU", they mean either, a traditional register based CPU running a Forth interpreter/compiler, or a stack processor running a Forth interpreter/compiler. What do you mean by "Forth CPU". To the best of my knowledge, there are no actual Forth CPUs in common use.

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Re: Jtag and Forth

<81cdf207-c989-4627-a45d-c01b9c6d8b49n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23288&group=comp.lang.forth#23288

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:15d6:b0:746:977f:3aef with SMTP id o22-20020a05620a15d600b00746977f3aefmr782226qkm.1.1682054535396;
Thu, 20 Apr 2023 22:22:15 -0700 (PDT)
X-Received: by 2002:a05:622a:4c:b0:3e6:c9e1:3020 with SMTP id
y12-20020a05622a004c00b003e6c9e13020mr1162503qtw.0.1682054535200; Thu, 20 Apr
2023 22:22:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 20 Apr 2023 22:22:14 -0700 (PDT)
In-Reply-To: <e49fd51b-f429-4351-ad27-e713a74f4cb3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=46.134.43.190; posting-account=qOvlJAoAAAALKIuQXXxAY1xxkFpdJUbI
NNTP-Posting-Host: 46.134.43.190
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com> <e49fd51b-f429-4351-ad27-e713a74f4cb3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <81cdf207-c989-4627-a45d-c01b9c6d8b49n@googlegroups.com>
Subject: Re: Jtag and Forth
From: calozin...@gmail.com (Christopher Lozinski)
Injection-Date: Fri, 21 Apr 2023 05:22:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Christopher Lozinski - Fri, 21 Apr 2023 05:22 UTC

Lorum Ipsum wrote
> there are no actual Forth CPUs in common use.

Correct. When I say Forth CPU, I mean a stack machine with multiple Forth words as primitives. Something like
the microcore, which has little usage, or Ting's EP 16/24/32 or the J1 and J1a. All barely in use.

After sleeping on it, I think that the way to use jtAG is as a test harness.. I can literally watch everything going on in a cpu, display it on a screen, or better yet, compare it to a simulation, to see where a misstep occurs.

Of course FPGA development takes much longer than software development, you cannot see what is going on inside of the chip. But if you attach a test harness, to be able to watch every thing that is going on, then it should be quite fast to develop and debug. The J1 is ony about 500 lines of code. The Ting ep16 is 2500 lines of code, if I have full visibility on what is going on, should be quite fast to test and debug.

Of course for production, I need to remove the test harness. I will then increase the clock speed, and when a bug arises, I will have no idea what the problem is, and fixing it will be very very slow. But that will only be a few timing bugs. Most will get caught with the test harness.

Am I on the right track?
Chris

Re: Jtag and Forth

<876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23289&group=comp.lang.forth#23289

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:152b:b0:74d:f84c:a132 with SMTP id n11-20020a05620a152b00b0074df84ca132mr816273qkk.9.1682059135910;
Thu, 20 Apr 2023 23:38:55 -0700 (PDT)
X-Received: by 2002:a05:622a:243:b0:3ef:1dfd:40eb with SMTP id
c3-20020a05622a024300b003ef1dfd40ebmr1279629qtx.11.1682059135617; Thu, 20 Apr
2023 23:38:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 20 Apr 2023 23:38:55 -0700 (PDT)
In-Reply-To: <81cdf207-c989-4627-a45d-c01b9c6d8b49n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=198.245.101.90; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 198.245.101.90
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>
<e49fd51b-f429-4351-ad27-e713a74f4cb3n@googlegroups.com> <81cdf207-c989-4627-a45d-c01b9c6d8b49n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com>
Subject: Re: Jtag and Forth
From: gnuarm.d...@gmail.com (Lorem Ipsum)
Injection-Date: Fri, 21 Apr 2023 06:38:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5210
 by: Lorem Ipsum - Fri, 21 Apr 2023 06:38 UTC

On Friday, April 21, 2023 at 1:22:16 AM UTC-4, Christopher Lozinski wrote:
> Lorum Ipsum wrote
> > there are no actual Forth CPUs in common use.
> Correct. When I say Forth CPU, I mean a stack machine with multiple Forth words as primitives. Something like
> the microcore, which has little usage, or Ting's EP 16/24/32 or the J1 and J1a. All barely in use.

Much better to call a rose, a rose. If you mean a stack CPU, say stack CPU, so we know exactly what you mean. Not like Humpty Dumpty who said, a word "means just what I choose it to mean — neither more nor less."

> After sleeping on it, I think that the way to use jtAG is as a test harness. I can literally watch everything going on in a cpu, display it on a screen, or better yet, compare it to a simulation, to see where a misstep occurs.

Yeah, this will take a lot of work. The "JTAG" interface will have to breakpoint on every instruction executed, and save context, which means all registers, all memory, etc. This will run at a snail's pace and make real time emulation impossible.

Why are you so insistent on catching all this data, rather than just debugging your code, a word at a time like most people debug Forth. Have you done much programming in Forth? Lots of people program Forth on PCs and use no such debugger. They debug the words, by testing them with specific inputs, and verifying the outputs. Words are typically written to be small enough to readily debug this way.

> Of course FPGA development takes much longer than software development, you cannot see what is going on inside of the chip.

I don't care to see what is going on inside the chip. By the time my design is loaded onto a chip, 99.9% of the bugs are gone, as shown in simulation.. It is rare that I need to examine internal processes. When I do, I use a debug port and an real, live, logic analyzer. But that's very exceptional.

> But if you attach a test harness, to be able to watch every thing that is going on, then it should be quite fast to develop and debug. The J1 is ony about 500 lines of code. The Ting ep16 is 2500 lines of code, if I have full visibility on what is going on, should be quite fast to test and debug.

If you use someone else's code that is already debugged, why do you need such tools? Are you planning extensive mods? Why can't you debug in simulation? Simulating HDL is not like other software. The simulation does not leave much untested. If you code works in simulation, but is different in the chip, you have done something very wrong in your coding style. The fix for this is to repair your coding style.

> Of course for production, I need to remove the test harness. I will then increase the clock speed, and when a bug arises, I will have no idea what the problem is, and fixing it will be very very slow. But that will only be a few timing bugs. Most will get caught with the test harness.

Timing bugs? Do you mean at the hardware level? That should not happen. HDL to FPGA tools have timing analysis tools that can check as much of the design as you wish. There is no reason for a timing error to ever reach production, even without testing on a chip.

> Am I on the right track?
> Chris

I think no. I just checked, and you are the software guy who had not designed hardware, but wants to work on advanced CPU designs. I believe you are also not an experienced Forth programmer, no? I think you will do best by learning how others write Forth programs and debug them, as well as how others design HDL and debug that.

There's no reason to reinvent the wheel.

--

Rick C.

+ Get 1,000 miles of free Supercharging
+ Tesla referral code - https://ts.la/richard11209

Re: Jtag and Forth

<27f4d24a-9a7f-4e56-9f26-409d83f45d6fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23296&group=comp.lang.forth#23296

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5a54:0:b0:3ef:3da0:5de7 with SMTP id o20-20020ac85a54000000b003ef3da05de7mr2306983qta.12.1682141197840;
Fri, 21 Apr 2023 22:26:37 -0700 (PDT)
X-Received: by 2002:ac8:5783:0:b0:3d8:c6c1:2925 with SMTP id
v3-20020ac85783000000b003d8c6c12925mr2315681qta.10.1682141197620; Fri, 21 Apr
2023 22:26:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 21 Apr 2023 22:26:37 -0700 (PDT)
In-Reply-To: <876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=46.134.3.248; posting-account=qOvlJAoAAAALKIuQXXxAY1xxkFpdJUbI
NNTP-Posting-Host: 46.134.3.248
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>
<e49fd51b-f429-4351-ad27-e713a74f4cb3n@googlegroups.com> <81cdf207-c989-4627-a45d-c01b9c6d8b49n@googlegroups.com>
<876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <27f4d24a-9a7f-4e56-9f26-409d83f45d6fn@googlegroups.com>
Subject: Re: Jtag and Forth
From: calozin...@gmail.com (Christopher Lozinski)
Injection-Date: Sat, 22 Apr 2023 05:26:37 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2045
 by: Christopher Lozinski - Sat, 22 Apr 2023 05:26 UTC

Lorum Ipsum wrote:
> By the time my design is loaded onto a chip, 99.9% of the bugs are gone, as shown in simulation. It is rare that I need to examine internal processes. When I do, I use a debug port and an real, live, logic analyzer.

Thank you. That is what i needed to know. What I had been told earlier is that it is very difficult to debug FPGA applications.

My worry was not about debugging the Forth, that part is comparatively easy. Use an existing Forth, or write a test case for each word. My worry was about debugging the CPU.

You are correct, I am new to both FPGA's and Forth.
My FPGA experience is growing rapidly.

>Logic Analyzer.
Thank you. One more thing to learn about!

Back to doing my homework.
Chris

Re: Jtag and Forth

<36ab25dc-4188-4bfc-a5d8-12d2b3941accn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23298&group=comp.lang.forth#23298

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:c3:b0:3ef:2db1:6e59 with SMTP id p3-20020a05622a00c300b003ef2db16e59mr3052309qtw.9.1682183957178;
Sat, 22 Apr 2023 10:19:17 -0700 (PDT)
X-Received: by 2002:ad4:4e6b:0:b0:5e6:9d14:6aeb with SMTP id
ec11-20020ad44e6b000000b005e69d146aebmr1484774qvb.9.1682183956880; Sat, 22
Apr 2023 10:19:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 22 Apr 2023 10:19:16 -0700 (PDT)
In-Reply-To: <27f4d24a-9a7f-4e56-9f26-409d83f45d6fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=63.114.57.174; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 63.114.57.174
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>
<e49fd51b-f429-4351-ad27-e713a74f4cb3n@googlegroups.com> <81cdf207-c989-4627-a45d-c01b9c6d8b49n@googlegroups.com>
<876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com> <27f4d24a-9a7f-4e56-9f26-409d83f45d6fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <36ab25dc-4188-4bfc-a5d8-12d2b3941accn@googlegroups.com>
Subject: Re: Jtag and Forth
From: gnuarm.d...@gmail.com (Lorem Ipsum)
Injection-Date: Sat, 22 Apr 2023 17:19:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4809
 by: Lorem Ipsum - Sat, 22 Apr 2023 17:19 UTC

On Saturday, April 22, 2023 at 1:26:38 AM UTC-4, Christopher Lozinski wrote:
> Lorum Ipsum wrote:
> > By the time my design is loaded onto a chip, 99.9% of the bugs are gone, as shown in simulation. It is rare that I need to examine internal processes. When I do, I use a debug port and an real, live, logic analyzer.
> Thank you. That is what i needed to know. What I had been told earlier is that it is very difficult to debug FPGA applications.

It is very difficult for people who do things in complicated ways, to debug FPGA applications.

The Forth method of writing small modules and debugging each one separately before combining with the others, is very useful and effective, not to mention efficient. But it is hard to apply in an HDL, because of the work involved in creating a module. In Forth, the extra work is mostly writing the stack effect comment ( a -- b). In Verilog, it is much more verbose and in VHDL they don't even use the term verbosity, because it's off the scale.

Still, it is useful to create a test bench for each module, even if it's a fair amount of work. This has been studied and measured. They found that every level earlier that a bug is found, it saves about 10x the work of finding it in the next stage. At system integration, it can be thousands of times more work to find a bug, than if it is caught in unit test. This is absolutely true for FPGA work. So create all the bugs you want, but find them early and often.

> My worry was not about debugging the Forth, that part is comparatively easy. Use an existing Forth, or write a test case for each word. My worry was about debugging the CPU.

All the same principles apply. Code your CPU in small pieces, and test each one thoroughly before integrating it with any others.

> You are correct, I am new to both FPGA's and Forth.
> My FPGA experience is growing rapidly.
>
> >Logic Analyzer.
> Thank you. One more thing to learn about!

But you are not likely to need it. If you find a bug in your stack processor, you can likely figure it out to a given instruction that isn't working correctly, or at least a section of code. Then you can run that section of code in the HDL simulation and see everything you wish. If it works in simulation, but fails in the chip, try slowing the clock 10x. If it runs then, your timing constraints are in error.

Timing constraints are vital to an FPGA design working correctly, but there is no way to debug them. The best you can do is to get a measurement of coverage, the percentage of the chip that the timing constraints apply to. To get this to 100%, requires adding constraints to parts of the design that you don't care about, such as the global reset signal. There is no way to constrain this usefully, unless your clock is very slow, but it is counted in the coverage number, so give it a constraint, of 1 second. Timing constraints are useful, but hard to verify.

You might try talking about the FPGA stuff in comp.arch.fpga. You will get some competing opinions, from people who like to use the fancy tools, such as the tool based logic analyzers.

--

Rick C.

-- Get 1,000 miles of free Supercharging
-- Tesla referral code - https://ts.la/richard11209

Re: Jtag and Forth

<nnd$5f1b52fd$60779edf@f58edf4564f557db>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23302&group=comp.lang.forth#23302

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com> <876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com> <27f4d24a-9a7f-4e56-9f26-409d83f45d6fn@googlegroups.com> <36ab25dc-4188-4bfc-a5d8-12d2b3941accn@googlegroups.com>
Subject: Re: Jtag and Forth
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$5f1b52fd$60779edf@f58edf4564f557db>
Organization: KPN B.V.
Date: Sun, 23 Apr 2023 11:39:03 +0200
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!2.eu.feeder.erje.net!feeder.erje.net!news.uzoreto.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 51
Injection-Date: Sun, 23 Apr 2023 11:39:03 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 3331
 by: none - Sun, 23 Apr 2023 09:39 UTC

In article <36ab25dc-4188-4bfc-a5d8-12d2b3941accn@googlegroups.com>,
Lorem Ipsum <gnuarm.deletethisbit@gmail.com> wrote:
>On Saturday, April 22, 2023 at 1:26:38 AM UTC-4, Christopher Lozinski wrote:
>> Lorum Ipsum wrote:
>> > By the time my design is loaded onto a chip, 99.9% of the bugs are
>gone, as shown in simulation. It is rare that I need to examine internal
>processes. When I do, I use a debug port and an real, live, logic
>analyzer.
>> Thank you. That is what i needed to know. What I had been told earlier
>is that it is very difficult to debug FPGA applications.
>
>It is very difficult for people who do things in complicated ways, to
>debug FPGA applications.
>
>The Forth method of writing small modules and debugging each one
>separately before combining with the others, is very useful and
>effective, not to mention efficient. But it is hard to apply in an HDL,
>because of the work involved in creating a module. In Forth, the extra
>work is mostly writing the stack effect comment ( a -- b). In Verilog,
>it is much more verbose and in VHDL they don't even use the term
>verbosity, because it's off the scale.
>
>Still, it is useful to create a test bench for each module, even if it's
>a fair amount of work. This has been studied and measured. They found
>that every level earlier that a bug is found, it saves about 10x the
>work of finding it in the next stage. At system integration, it can be
>thousands of times more work to find a bug, than if it is caught in unit
>test. This is absolutely true for FPGA work. So create all the bugs
>you want, but find them early and often.

In general the more work testing a module is, the more useful is
desk checking. This is the art of studying your code carefully,
and simulating in your mind what has to be happening.
I tend to add to this a careful, almost legal, description of
each factor (Forth word). It has benefited me, but I am a lousy
programmer (really), I flunked the first assignment for numerical
analysis.

I seen some star FORTRAN programmers who did this, and then use
single stepping once, to verify if it agrees with the desk checking.
Other situation than Forth requires different techniques.

> Rick C.

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: Jtag and Forth

<438c285a-96fb-455f-b85c-0f47552dabc8n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23317&group=comp.lang.forth#23317

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5a84:0:b0:3ef:3126:7dca with SMTP id c4-20020ac85a84000000b003ef31267dcamr3942969qtc.2.1682253087815;
Sun, 23 Apr 2023 05:31:27 -0700 (PDT)
X-Received: by 2002:a05:622a:18d:b0:3ea:3d30:af91 with SMTP id
s13-20020a05622a018d00b003ea3d30af91mr3281926qtw.1.1682253087617; Sun, 23 Apr
2023 05:31:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 23 Apr 2023 05:31:27 -0700 (PDT)
In-Reply-To: <nnd$5f1b52fd$60779edf@f58edf4564f557db>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f18:6d00:8478:4a1a:4531:7f4a;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f18:6d00:8478:4a1a:4531:7f4a
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>
<876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com> <27f4d24a-9a7f-4e56-9f26-409d83f45d6fn@googlegroups.com>
<36ab25dc-4188-4bfc-a5d8-12d2b3941accn@googlegroups.com> <nnd$5f1b52fd$60779edf@f58edf4564f557db>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <438c285a-96fb-455f-b85c-0f47552dabc8n@googlegroups.com>
Subject: Re: Jtag and Forth
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Sun, 23 Apr 2023 12:31:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Marcel Hendrix - Sun, 23 Apr 2023 12:31 UTC

On Sunday, April 23, 2023 at 11:39:07 AM UTC+2, none albert wrote:
[..]
> In general the more work testing a module is, the more useful is
> desk checking. This is the art of studying your code carefully,
> and simulating in your mind what has to be happening.

I have been trying to do that for 40 years now, and I still can't
get it right. Most of my bugs are caused by being 100%
convinced that something works like "a", while actually it is
"b". (`5 1 do .. loop` exits after 5 iterations .., this word prints
a space after the output, ...).
Quite early on, I decided that it was more productive
to 'prototype' small parts of my code. For that it is
needed that they are not depending on global data,
and that scaffolding is inexpensive. It is also important
that the parts are not so small that the final assembly
becomes inscrutable because there are too many parts (here
it clashes with the `factor, factor` paradigm of Forth). When
this goes right, the work is in refining the assembly of small
components so that they produce the optimal result.
Unfortunately, this way of working does not align well with
working in teams.

> I tend to add to this a careful, almost legal, description of
> each factor (Forth word). It has benefited me, [..]

I add the legalese after it works, because I know that I won't
follow the rules when I spot a possible improvement or
simplification.
> I seen some star FORTRAN programmers who did this, and then use
> single stepping once, to verify if it agrees with the desk checking.
> Other situation than Forth requires different techniques.

Well, if the specification is very precise and one has no self-interest
in the result, I guess this can work.

-marcel

Re: Jtag and Forth

<2023Apr25.085100@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23329&group=comp.lang.forth#23329

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Jtag and Forth
Date: Tue, 25 Apr 2023 06:51:00 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 54
Message-ID: <2023Apr25.085100@mips.complang.tuwien.ac.at>
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com> <876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com> <27f4d24a-9a7f-4e56-9f26-409d83f45d6fn@googlegroups.com> <36ab25dc-4188-4bfc-a5d8-12d2b3941accn@googlegroups.com> <nnd$5f1b52fd$60779edf@f58edf4564f557db> <438c285a-96fb-455f-b85c-0f47552dabc8n@googlegroups.com>
Injection-Info: dont-email.me; posting-host="5cfc98affaa27dd0bbcd7505b6697e1c";
logging-data="824771"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GMr08aeAchRxbXVw8J5Ob"
Cancel-Lock: sha1:HpJjrs0enqlbyS8nBqW6klmx9Nk=
X-newsreader: xrn 10.11
 by: Anton Ertl - Tue, 25 Apr 2023 06:51 UTC

Marcel Hendrix <mhx@iae.nl> writes:
>Quite early on, I decided that it was more productive
>to 'prototype' small parts of my code. For that it is
>needed that they are not depending on global data,
>and that scaffolding is inexpensive. It is also important
>that the parts are not so small that the final assembly
>becomes inscrutable because there are too many parts (here
>it clashes with the `factor, factor` paradigm of Forth).

I don't see a problem. You don't have parts at just one level. Small
parts are assembled to bigger parts. If you try to assemble the
bigger parts just from primitives, the big part may become excessively
complex, and it may be better to compartmentalize this complexity into
smaller parts.

That being said, code that provides a lot of flexibility by factoring
and deferred words is often harder to follow than more
straightforward, but inflexible code. But that's not limited to
Forth.

>When
>this goes right, the work is in refining the assembly of small
>components so that they produce the optimal result.
>Unfortunately, this way of working does not align well with
>working in teams.

I don't think that's the case. If the components have a good
interface, the implementor of a component can work independently of
the user of the component. (I don't think that this independence
means lack of teamwork for you, does it?)

Admittedly, finding a good interface is hard and often takes several
attempts.

The data stack is such an interface: there have been repeated
discussions of adding registers, but they have never really taken off,
and here we are, 50+ years after the inception of Forth, still passing
data on the stack. And the implementors of a Forth system can add a
word that the users of the Forth system can use, and that other Forth
system implementors can implement, because we have this interface.

If we used registers for interfacing instead, either a lot of the
first implementation would be exposed accidentially in the interface,
or we would have to follow a calling convention like is used for
register machines, with saving some registers at the caller, some at
the callee, and passing the parameters and return values in specific
registers.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2022: https://euro.theforth.net

Re: Jtag and Forth

<9921d2e3-6855-4246-9312-70470df98102n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23331&group=comp.lang.forth#23331

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5c15:0:b0:3ef:3204:5158 with SMTP id i21-20020ac85c15000000b003ef32045158mr6417075qti.7.1682410655875;
Tue, 25 Apr 2023 01:17:35 -0700 (PDT)
X-Received: by 2002:a05:6214:aa4:b0:5ef:7245:33e9 with SMTP id
ew4-20020a0562140aa400b005ef724533e9mr3086263qvb.0.1682410655734; Tue, 25 Apr
2023 01:17:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!peer01.ams4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Tue, 25 Apr 2023 01:17:35 -0700 (PDT)
In-Reply-To: <438c285a-96fb-455f-b85c-0f47552dabc8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f00:13f9:e5e9:36f0:cada:e76d;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f00:13f9:e5e9:36f0:cada:e76d
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>
<876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com> <27f4d24a-9a7f-4e56-9f26-409d83f45d6fn@googlegroups.com>
<36ab25dc-4188-4bfc-a5d8-12d2b3941accn@googlegroups.com> <nnd$5f1b52fd$60779edf@f58edf4564f557db>
<438c285a-96fb-455f-b85c-0f47552dabc8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9921d2e3-6855-4246-9312-70470df98102n@googlegroups.com>
Subject: Re: Jtag and Forth
From: minfo...@arcor.de (minforth)
Injection-Date: Tue, 25 Apr 2023 08:17:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4798
 by: minforth - Tue, 25 Apr 2023 08:17 UTC

Marcel Hendrix schrieb am Sonntag, 23. April 2023 um 14:31:28 UTC+2:
> On Sunday, April 23, 2023 at 11:39:07 AM UTC+2, none albert wrote:
> [..]
> > In general the more work testing a module is, the more useful is
> > desk checking. This is the art of studying your code carefully,
> > and simulating in your mind what has to be happening.
> I have been trying to do that for 40 years now, and I still can't
> get it right. Most of my bugs are caused by being 100%
> convinced that something works like "a", while actually it is
> "b". (`5 1 do .. loop` exits after 5 iterations .., this word prints
> a space after the output, ...).
> Quite early on, I decided that it was more productive
> to 'prototype' small parts of my code. For that it is
> needed that they are not depending on global data,
> and that scaffolding is inexpensive. It is also important
> that the parts are not so small that the final assembly
> becomes inscrutable because there are too many parts (here
> it clashes with the `factor, factor` paradigm of Forth). When
> this goes right, the work is in refining the assembly of small
> components so that they produce the optimal result.
> Unfortunately, this way of working does not align well with
> working in teams.
> > I tend to add to this a careful, almost legal, description of
> > each factor (Forth word). It has benefited me, [..]
>
> I add the legalese after it works, because I know that I won't
> follow the rules when I spot a possible improvement or
> simplification.
> > I seen some star FORTRAN programmers who did this, and then use
> > single stepping once, to verify if it agrees with the desk checking.
> > Other situation than Forth requires different techniques.
> Well, if the specification is very precise and one has no self-interest
> in the result, I guess this can work.
I have a 'release' and 'debug' version of my system. The debug version
comprises runtime stack checking (with a special catch-throw mechanism
not present in the release version), T{ -- }T built in, stepping debugger, etc.
The release version generates no such code.

Developing, my factored code looks about like:

: FACTOR1 < some code > ; INLINE
T{ <testcase> }T
T{ <testcase> }T

: _FACTOR2 < some code > ; \ INLINE
T{ <testcase> }T
T{ <testcase> }T
...

: NEWWORD ... factorx ... factory ... factorz ... ;
T{ <testcase> }T
T{ <testcase> }T

Compiled with release flag, factors are inlined (when marked) and all
T{ -- }T are ignored (treated as comments). Headers of inlined words
and with names beginning with an _underscore are deleted from the dictionary.

After decades of coding this works best for me. It requires a bit more
discipline than just hacking away, but it brings:
- while writing the test cases I concentrate more on the algorithm
and often detect subtle program logic flaws
- if I find/invent a new idea for program optimization, the test cases are
already there, which helps a lot!

Although this looks like more work it is less, because otherwise one
would have to do the tests (repeatedly) on the command line afterwards.

Re: Jtag and Forth

<nnd$4d8f1427$3ad87227@bb1c332b98e0b20e>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23337&group=comp.lang.forth#23337

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: Jtag and Forth
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com> <nnd$5f1b52fd$60779edf@f58edf4564f557db> <438c285a-96fb-455f-b85c-0f47552dabc8n@googlegroups.com> <9921d2e3-6855-4246-9312-70470df98102n@googlegroups.com>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$4d8f1427$3ad87227@bb1c332b98e0b20e>
Organization: KPN B.V.
Date: Tue, 25 Apr 2023 15:13:51 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 89
Injection-Date: Tue, 25 Apr 2023 15:13:51 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 4761
 by: none - Tue, 25 Apr 2023 13:13 UTC

In article <9921d2e3-6855-4246-9312-70470df98102n@googlegroups.com>,
minforth <minforth@arcor.de> wrote:
>Marcel Hendrix schrieb am Sonntag, 23. April 2023 um 14:31:28 UTC+2:
>> On Sunday, April 23, 2023 at 11:39:07 AM UTC+2, none albert wrote:
>> [..]
>> > In general the more work testing a module is, the more useful is
>> > desk checking. This is the art of studying your code carefully,
>> > and simulating in your mind what has to be happening.
>> I have been trying to do that for 40 years now, and I still can't
>> get it right. Most of my bugs are caused by being 100%
>> convinced that something works like "a", while actually it is
>> "b". (`5 1 do .. loop` exits after 5 iterations .., this word prints
>> a space after the output, ...).
>> Quite early on, I decided that it was more productive
>> to 'prototype' small parts of my code. For that it is
>> needed that they are not depending on global data,
>> and that scaffolding is inexpensive. It is also important
>> that the parts are not so small that the final assembly
>> becomes inscrutable because there are too many parts (here
>> it clashes with the `factor, factor` paradigm of Forth). When
>> this goes right, the work is in refining the assembly of small
>> components so that they produce the optimal result.
>> Unfortunately, this way of working does not align well with
>> working in teams.
>> > I tend to add to this a careful, almost legal, description of
>> > each factor (Forth word). It has benefited me, [..]
>>
>> I add the legalese after it works, because I know that I won't
>> follow the rules when I spot a possible improvement or
>> simplification.
>> > I seen some star FORTRAN programmers who did this, and then use
>> > single stepping once, to verify if it agrees with the desk checking.
>> > Other situation than Forth requires different techniques.
>> Well, if the specification is very precise and one has no self-interest
>> in the result, I guess this can work.
>
>I have a 'release' and 'debug' version of my system. The debug version
>comprises runtime stack checking (with a special catch-throw mechanism
>not present in the release version), T{ -- }T built in, stepping debugger, etc.
>The release version generates no such code.
>
>Developing, my factored code looks about like:
>
>: FACTOR1 < some code > ; INLINE
>T{ <testcase> }T
>T{ <testcase> }T
>
>: _FACTOR2 < some code > ; \ INLINE
>T{ <testcase> }T
>T{ <testcase> }T
>..
>
>: NEWWORD ... factorx ... factory ... factorz ... ;
>T{ <testcase> }T
>T{ <testcase> }T
>
>Compiled with release flag, factors are inlined (when marked) and all
>T{ -- }T are ignored (treated as comments). Headers of inlined words
>and with names beginning with an _underscore are deleted from the dictionary.
>
>After decades of coding this works best for me. It requires a bit more
>discipline than just hacking away, but it brings:
>- while writing the test cases I concentrate more on the algorithm
>and often detect subtle program logic flaws
>- if I find/invent a new idea for program optimization, the test cases are
>already there, which helps a lot!
>
>Although this looks like more work it is less, because otherwise one
>would have to do the tests (repeatedly) on the command line afterwards.

That is similar to my REGRESS system
REGRESS 1 2 + S: 3

Production ciforth code is mostly an executable.
lina -c
automatically revectors REGRESS to be a stack comment.

The more involved a system is, the more it pays off.
The optimiser of ciforth has 590 REGRESS lines.
Refactoring so complicated a system is nerve wrecking unless you have
such a mechanism in place.

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: Jtag and Forth

<u297g5$vqfc$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23345&group=comp.lang.forth#23345

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: Jtag and Forth
Date: Tue, 25 Apr 2023 19:51:50 +0100
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <u297g5$vqfc$1@dont-email.me>
References: <e4420dc0-b61f-4fea-a3c6-af8fb3ef9321n@googlegroups.com>
<876828d0-a981-46a4-ad89-f49babd5e060n@googlegroups.com>
<27f4d24a-9a7f-4e56-9f26-409d83f45d6fn@googlegroups.com>
<36ab25dc-4188-4bfc-a5d8-12d2b3941accn@googlegroups.com>
<nnd$5f1b52fd$60779edf@f58edf4564f557db>
<438c285a-96fb-455f-b85c-0f47552dabc8n@googlegroups.com>
<9921d2e3-6855-4246-9312-70470df98102n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 25 Apr 2023 18:51:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="37f4901962d603ef0a640c0767a65b90";
logging-data="1042924"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UXaaTdSobxuP+BSKwXhu7F2vX5EvPeV4="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:JxhsRpTCvzSIStAPPOilUUCpfmQ=
In-Reply-To: <9921d2e3-6855-4246-9312-70470df98102n@googlegroups.com>
 by: Gerry Jackson - Tue, 25 Apr 2023 18:51 UTC

On 25/04/2023 09:17, minforth wrote:
> Marcel Hendrix schrieb am Sonntag, 23. April 2023 um 14:31:28 UTC+2:
>> On Sunday, April 23, 2023 at 11:39:07 AM UTC+2, none albert wrote:
>> [..]
>>> In general the more work testing a module is, the more useful is
>>> desk checking. This is the art of studying your code carefully,
>>> and simulating in your mind what has to be happening.
>> I have been trying to do that for 40 years now, and I still can't
>> get it right. Most of my bugs are caused by being 100%
>> convinced that something works like "a", while actually it is
>> "b". (`5 1 do .. loop` exits after 5 iterations .., this word prints
>> a space after the output, ...).
>> Quite early on, I decided that it was more productive
>> to 'prototype' small parts of my code. For that it is
>> needed that they are not depending on global data,
>> and that scaffolding is inexpensive. It is also important
>> that the parts are not so small that the final assembly
>> becomes inscrutable because there are too many parts (here
>> it clashes with the `factor, factor` paradigm of Forth). When
>> this goes right, the work is in refining the assembly of small
>> components so that they produce the optimal result.
>> Unfortunately, this way of working does not align well with
>> working in teams.
>>> I tend to add to this a careful, almost legal, description of
>>> each factor (Forth word). It has benefited me, [..]
>>
>> I add the legalese after it works, because I know that I won't
>> follow the rules when I spot a possible improvement or
>> simplification.
>>> I seen some star FORTRAN programmers who did this, and then use
>>> single stepping once, to verify if it agrees with the desk checking.
>>> Other situation than Forth requires different techniques.
>> Well, if the specification is very precise and one has no self-interest
>> in the result, I guess this can work.
>
> I have a 'release' and 'debug' version of my system. The debug version
> comprises runtime stack checking (with a special catch-throw mechanism
> not present in the release version), T{ -- }T built in, stepping debugger, etc.
> The release version generates no such code.
>
> Developing, my factored code looks about like:
>
> : FACTOR1 < some code > ; INLINE
> T{ <testcase> }T
> T{ <testcase> }T
>
> : _FACTOR2 < some code > ; \ INLINE
> T{ <testcase> }T
> T{ <testcase> }T
> ..
>
> : NEWWORD ... factorx ... factory ... factorz ... ;
> T{ <testcase> }T
> T{ <testcase> }T
>
> Compiled with release flag, factors are inlined (when marked) and all
> T{ -- }T are ignored (treated as comments). Headers of inlined words
> and with names beginning with an _underscore are deleted from the dictionary.
>
> After decades of coding this works best for me. It requires a bit more
> discipline than just hacking away, but it brings:
> - while writing the test cases I concentrate more on the algorithm
> and often detect subtle program logic flaws
> - if I find/invent a new idea for program optimization, the test cases are
> already there, which helps a lot!
>
> Although this looks like more work it is less, because otherwise one
> would have to do the tests (repeatedly) on the command line afterwards.

I too write test cases as I develop software for the same reasons.
However I find it more convenient to put the tests in a separate file
for two reasons. Firstly I have a set of test helper definitions that
are commonly used and secondly I sometimes need to build test data
structures. I don't want these to clutter the source code of the
application/tool.

--
Gerry

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor