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

always @ ( * ) combinational block #41

Closed
kiteloopdesign opened this issue Apr 23, 2021 · 2 comments
Closed

always @ ( * ) combinational block #41

kiteloopdesign opened this issue Apr 23, 2021 · 2 comments

Comments

@kiteloopdesign
Copy link

Hi, is there any example about how to get some combinational block? grepping on the examples I found something but it all is related to the test and not the generated RTL I believe?

veriloggen/examples$ grep  -r -e "always @(\*" * -l

simulation_verilator/test_simulation_verilator.py
thread_add_ipxact/test_thread_add_ipxact.py
thread_embedded_verilog_ipxact/test_thread_embedded_verilog_ipxact.py
thread_ipxact/test_thread_ipxact.py
thread_memcpy_ipxact/test_thread_memcpy_ipxact.py
thread_verilog_submodule_ipxact/test_thread_verilog_submodule_ipxact.py

In other words, what I need to get is a block of this form.

always @ ( * ) begin
end

Ideally this block would have some more logic inside, some if-else maybe.

always @ ( * ) begin
var1 = some_other_Var
if ( var1 == yet_oher_var) begin
assign_this = 1;
end
else begin
assign_this = 0;
end
end

Is this possible?

@LucasBraganca
Copy link

LucasBraganca commented Apr 23, 2021

Hi SiliconKite, it's possible to do this, you only need usage Always() without parameters.

from veriloggen import *

m = Module("CombModule")
a = m.Input("a")
b = m.Input("b")
c = m.OutputReg("c")

m.Always()(
  c(a ^ b)    
)

m.to_verilog("CombModule.v")

@kiteloopdesign
Copy link
Author

it works indeed!
thanks for the quick response!

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

2 participants