SteffenReith / J1Sc

A reimplementation of a tiny stack CPU
BSD 3-Clause "New" or "Revised" License
78 stars 7 forks source link

A simple starting Point #4

Open PythonLinks opened 11 months ago

PythonLinks commented 11 months ago

So I flashed a blinky onto my pico-ice board using SpinalHDL and apio. Hurrah. Now I am trying to synthesize the J1SC for the Pico-Ice board. Oh boy, it is quite tricky. There is a lot of stuff in there.

What Mecrisp did is to creae a directory skeletalstructure which just had the core parts in it. It was easy to get it up and running, and then one could add things back in one at a time.

Your code has LED arrays, button arrays, a uart led, a pwm led, interrupts, bridges, a clock lock, and who knows what else.

It takes a while to read all of the code, figure out what they all do, and figure out how to turn them off.

The problem is that it is lots of changes, and then at the end of the day, when everything is not working, I will not know what I broke. The ideal is to make it easy to get the first version working on an FPGA.

As a software developer, I would always make lots of changes and then debug it. As an FPGA developer, they repeatedly instruct us to make one change at a time, get it to work, and then make the next change.

I am not asking that you do anything, I am just recording what might make life easier for those who follow in my footsteps.

PythonLinks commented 11 months ago

On further thought I know what I need. A little guidance. The Pico-Ice just has 3 LEDs, red, green and blue, and one button. Your boards all have a lot more options. Can I just start with one of your boards, set almost all of the options to null, and everything should work? Which board is the best one to start with, maybe the most recent software? Which files should I touch. Will all of the null options really get ignored, or will it generate an error?

Then once I get the board working, I can create a separate board definition.

I can eventually figure this stuff out, but some guidance, if you have time, would save me much time.

PythonLinks commented 11 months ago

And obviously I have to give it a pcf file.

Here are some minor potential fixes.

If you take a look at your pcf files.

find . -name "*.pcf" ./doc/lattice/icoboard.pcf ./src/main/lattice/IcoBoard/J1Ico.pcf ./src/main/lattice/IceStick/Pins.pcf ./src/main/lattice/IceBreaker/J1Ice.pcf

I presume that you can delete the one in the doc directory.

I would have expected all of the pcf files, to have the same name, since the directory defines which board they are for. Or to have all of the pcf files in the same directory, but to give them the board name.

Just minor details for future fixing. No rush.

PythonLinks commented 11 months ago

So first of all @SteffenReith did say

(have a look at the devel-branch) to learn the features of SpinalHDL and to serve as a starting point and non-trivial example for a Spinal-beginner.

And while i did immediately go and look at it, I then failed to pop the return stack, read the rest of the sentence, and use it as my starting point. OOPS!

Next up, if you take a look at that devel branch, the file called J1Sc/src/main/scala/J1Core.scala is really very simple. Somehow much simpler than the original J1 in Verilog. Not quite sure why the code is so much cleaner, but it is.

The problem is that the scala files J1Ice, J1Config, and J1 add a lot of complexity. Really all I need are the J1Core, memory and uart interfaces. Sadly the uart interfaces pull in a whole bunch of other stuff.

I think I need to go into those files, make copies, strip out all but the essential J1 stuff, and then I would have a very simple starting point. But somehow that is still very scary. I just want a simple starting point.

One more point. If we could move the board files to a directory called boards, and the J1 components to a directory called components, or modules, that would be most helpful in reducing the cognitive load.