Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Documentation/Tutorials #19

Open
xd009642 opened this issue Jan 29, 2019 · 6 comments
Open

Better Documentation/Tutorials #19

xd009642 opened this issue Jan 29, 2019 · 6 comments

Comments

@xd009642
Copy link

So the examples are useful for somethings but say if I want to have nested if statements or make something that generates this verilog:

reg signed [width:0] x [0:width-1];
always @(posedge clock) begin
    x[0] <= 0
end

I've found myself doing a lot of trial and error, reading the source and scouring the existing examples trying to find something that would use these constructs (it's not always obvious from the example names).

Also, both these issues are still unresolved for me. I'm trying to write a coregen script to generate a cordic IP block.

@xd009642
Copy link
Author

xd009642 commented Feb 9, 2019

I've figured out the issues I currently had. One thing I've failed to figure out how to do is an expression like so:

input wire	signed [(12-1):0] i_xval;
...
wire	signed [(15-1):0]	e_xval;
assign	e_xval = { {i_xval[(12-1)]}, i_xval, {(3-1){1'b0}} };

@LucasBraganca
Copy link

LucasBraganca commented Feb 9, 2019

Hi, this would be something like this:

from veriloggen import *

def make_module():
  m = Module('xval')
  i_xval = m.Input('i_xval',12,signed=True)
  e_xval = m.Wire('e_xval',15,signed=True)
  e_xval.assign(Cat(i_xval[11],i_xval,Repeat(Int(0,1,2),2)))
  
  return m

print(make_module().to_verilog())

@xd009642
Copy link
Author

That fixed my issue thanks! Is there any appetite for improving the veriloggen docs, and maybe having HTML docs hosted somewhere? Whenever I run into an issue I normally spend time going through tests and examples looking for anything that solves it and then going through the actual code which is less than ideal.

@shtaxxx
Copy link
Member

shtaxxx commented Feb 20, 2019

HTML docs hosted somewhere

I should prepare such documents ...

@xd009642
Copy link
Author

I've not published any python projects myself that have required docs but pydoc should be able to generate docs from doc comments on classes and methods. It's just a case of doc comments for existing code

@Nic30
Copy link

Nic30 commented Feb 20, 2019

@shtaxxx I am using Sphinx code generator together with readthedocs.io
https://github.com/Nic30/hwtLib/blob/master/docs/conf.py

https://hwtlib.readthedocs.io/en/latest/?badge=latest

I was relatively good and it usually works however you may have to fix some code style of doc in your code. Sphinx can also generate PDF/epub/... and readthedocs.io also supports any files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants