Johnlon / spam-1

Home Brew 8 Bit CPU Hardware Implementation including a Verilog simulation, an assembler, a "C" Compiler and this repo also contains my research and learning. See also the Hackaday.IO project. https://hackaday.io/project/166922-spam-1-8-bit-cpu
https://www.youtube.com/playlist?list=PLdLE_IdL0sqyAxmmHNbp0Q6dVWFVW8zQQ
Mozilla Public License 2.0
63 stars 8 forks source link

Can I use your UART with verilator? #4

Open willlogs opened 2 years ago

willlogs commented 2 years ago

Hi John. Thank you for your amazing repo!

I don't have access to an FPGA and am trying to build something like spam-1 on verilator. I'm starting with the UART and am trying to use your implementation of it.

The thing is that verilator is run on c++ and can't possibly pass data to the UART module in a 9600 bits/sec speed. Do I NEED to choose a lower speed to be able to do this or am I doing something wrong?

Johnlon commented 2 years ago

Spam-1 is a breadboard build btw and I have no experience of fpga.

I use verilog as it allowed me to simulate all the 7400 components during the build.

The uart model I wrote for the ftdi device was useful for my Sims as I can interact with it over a file.

I don't know how useful it would be for your use case. I don't consider baud rates when thinking about this stuff because like I say the "terminal" in my case are files not a serial cable.

Perhaps some more info.

Johnlon commented 2 years ago

Perhaps you have some code to show and discuss?

Johnlon commented 2 years ago

Also since I use Icarus verilog and not verilator there will be mods needed.

It would be good if these could be added to my model using #defines rather than creating an disconnected model if possible.

I can't exactly recall why I don't use verilator - I'm sure there was a reason. Icarus verilog isn't super fast tho it does allow me to run with realistic propagation delays which has helped spot errors.

willlogs commented 2 years ago

What do you mean by not considering baud rate? Are you using an automated port of some sort that takes care of the baud rate itself?

All I need is also some sort of a terminal.

I'm currently researching things and I'm having trouble understanding how one can simulate UART in cpp.

btw thank you for your fast response. Maybe I can get back to you with some code to discuss later. I really appreciate your will to share your knowledge with me.

I was using icarus at first too but had trouble with giving it user input (dynamically setting some wires to have specific values or something like that). Any resources in that area would be appreciated.

On Tue, May 24, 2022, 10:08 PM John Lonergan @.***> wrote:

Perhaps you have some code to show and discuss?

— Reply to this email directly, view it on GitHub https://github.com/Johnlon/spam-1/issues/4#issuecomment-1136249332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGAYEEIXC3TIG3Y4JNYTEULVLUHZLANCNFSM5W2KKXEA . You are receiving this because you authored the thread.Message ID: @.***>

Johnlon commented 2 years ago

Icarus can take input from the console if you want to interact with the simulation.

Baud has nothing to do with my uart model. It's just a model of a uart that behaves like a um245r to the rest of the verilog SIM and connects to file io on the local filesystem for external interactive things. There is no terminal and no serial line so no baud.

On Tue, 24 May 2022, 6:50 pm Will, @.***> wrote:

What do you mean by not considering baud rate? Are you using an automated port of some sort that takes care of the baud rate itself?

All I need is also some sort of a terminal.

I'm currently researching things and I'm having trouble understanding how one can simulate UART in cpp.

btw thank you for your fast response. Maybe I can get back to you with some code to discuss later. I really appreciate your will to share your knowledge with me.

I was using icarus at first too but had trouble with giving it user input (dynamically setting some wires to have specific values or something like that). Any resources in that area would be appreciated.

On Tue, May 24, 2022, 10:08 PM John Lonergan @.***> wrote:

Perhaps you have some code to show and discuss?

— Reply to this email directly, view it on GitHub https://github.com/Johnlon/spam-1/issues/4#issuecomment-1136249332, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AGAYEEIXC3TIG3Y4JNYTEULVLUHZLANCNFSM5W2KKXEA

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/Johnlon/spam-1/issues/4#issuecomment-1136259731, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGMFGEZZWCSR4CXXYCL4GLVLUJE5ANCNFSM5W2KKXEA . You are receiving this because you commented.Message ID: @.***>

willlogs commented 2 years ago

Got it!

Thank you so much for your help.

On Wed, May 25, 2022, 7:14 AM John Lonergan @.***> wrote:

Icarus can take input from the console if you want to interact with the simulation.

Baud has nothing to do with my uart model. It's just a model of a uart that behaves like a um245r to the rest of the verilog SIM and connects to file io on the local filesystem for external interactive things. There is no terminal and no serial line so no baud.

On Tue, 24 May 2022, 6:50 pm Will, @.***> wrote:

What do you mean by not considering baud rate? Are you using an automated port of some sort that takes care of the baud rate itself?

All I need is also some sort of a terminal.

I'm currently researching things and I'm having trouble understanding how one can simulate UART in cpp.

btw thank you for your fast response. Maybe I can get back to you with some code to discuss later. I really appreciate your will to share your knowledge with me.

I was using icarus at first too but had trouble with giving it user input (dynamically setting some wires to have specific values or something like that). Any resources in that area would be appreciated.

On Tue, May 24, 2022, 10:08 PM John Lonergan @.***> wrote:

Perhaps you have some code to show and discuss?

— Reply to this email directly, view it on GitHub https://github.com/Johnlon/spam-1/issues/4#issuecomment-1136249332, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AGAYEEIXC3TIG3Y4JNYTEULVLUHZLANCNFSM5W2KKXEA

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/Johnlon/spam-1/issues/4#issuecomment-1136259731, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAGMFGEZZWCSR4CXXYCL4GLVLUJE5ANCNFSM5W2KKXEA

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/Johnlon/spam-1/issues/4#issuecomment-1136663522, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGAYEEKSWZZPPZX2CRVWKYDVLWHZRANCNFSM5W2KKXEA . You are receiving this because you authored the thread.Message ID: @.***>