# Multiple @always\_comb needed - why?

**URL:** https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535
**Category:** Support
**Created:** [April 22, 2022, 3:44am UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535 "2022-04-22T03:44:57Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![steveg](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@steveg](https://discourse.myhdl.org/u/steveg)
#### Post date: [April 22, 2022, 3:44am UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/1 "2022-04-22T03:44:58Z")

</div>

Hi All,

I think I am missing something on how I an constructing combinatorial logic, as it seems like I need to specify a separate comb process if I calc and then use this calc further on in the same process.

(I hope I have captured working code below for someone to test)

In Verilog we can create a design like this:

module my\_test(a, b, c);

input wire [3:0] a;  
input wire [3:0] b;  
output reg [4:0] c;

reg [3:0] z;

always @ (a, b) begin  
z = a + 4’h1;  
c = z + b;  
end

endmodule

and from what I see you write this in myhdl as :  
from myhdl import \*

@block  
def test(  
a,  
b,  
c):

```
z = Signal(intbv(0)[4:])

@always_comb
def comb_logic():
    z.next = (a + intbv(1)[4:])
    c.next = (z + b)

return instances()

```

if ( **name** == ‘ **main** ’):  
a = Signal(intbv(0)[4:])  
b = Signal(intbv(0)[4:])  
c = Signal(intbv(0)[4:])

```
design = test(
            a,
            b,
            c)

```

it fails unless you specify the z.next in its own process … here’s the functioning code  
from myhdl import \*

@block  
def test(  
a,  
b,  
c):

```
z = Signal(intbv(0)[4:])

@always_comb
def comb_logic():
    z.next = (a + intbv(1)[4:])

@always_comb
def comb_logic():
    c.next = (z + b)

return instances()

```

if ( **name** == ‘ **main** ’):  
a = Signal(intbv(0)[4:])  
b = Signal(intbv(0)[4:])  
c = Signal(intbv(0)[4:])

```
design = test(
            a,
            b,
            c)
```

---

<div class="post-metadata">

### Author: ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)
#### Post date: [April 22, 2022, 7:36am UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/2 "2022-04-22T07:36:05Z")

</div>

Hi Steve,

you stumbled on yet another remains of the early days; only this one throws an error.  
I have discussed this at the time with the development leaders but it never got resolved. I commented out the _offending_ code in my local development tree (which is totally separate from the support tree).  
It is time we solve this one.

Regards,  
Josy

---

<div class="post-metadata">

### Author: ![steveg](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@steveg](https://discourse.myhdl.org/u/steveg)
#### Post date: [April 22, 2022, 11:08pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/3 "2022-04-22T23:08:25Z")

</div>

Hi Josy,

Sorry for the uncovering of previous discoveries - its just that I have embarked on a full development cycle and have decided to use myHDL for this - and so using the tool in a serious way uncovers these pitfalls I guess.

Is there a timeline to getting this resolved, I cant do it as I have no python skills, and for now I can comment my code and it will compile in any case, but a fix would just make the code more sensible looking

Regards,  
Steve

---

<div class="post-metadata">

### Author: ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)
#### Post date: [April 24, 2022, 7:15am UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/4 "2022-04-24T07:15:54Z")

</div>

Hi Steve,

I already issued a PR to delete that error check. But it is waiting on the Travis-CI continuous integration check which, for reasons unknown to me, doesn’t start. I will try to look into that matter asap.

Regards,  
Josy

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 25, 2022, 7:39pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/5 "2022-04-25T19:39:39Z")

</div>

Have you migrated from [travis-ci.org](http://travis-ci.org) to [travis-ci.com](http://travis-ci.com)?

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/myhdl/original/1X/02ab64a4b21abd7254beb934b0310b5c4f89b995.png)

If not it might be time to look at github actions. I moved over a project of mine a while back. It is a pain, but travis are beginning to charge a bit too much for their work.

---

<div class="post-metadata">

### Author: ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)
#### Post date: [April 26, 2022, 8:24am UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/6 "2022-04-26T08:24:32Z")

</div>

Dave, thanks for the info.  
I only recently received commit rights, and running this all is quite new to me.  
I believe travis-ci is free for Open-Source projects. Getting it going again would be the easy (lazy, sorry) way out.

Edit: I checked [travis-ci.com](http://travis-ci.com) and don’t readily find a _free plan_ ☹  
Second edit: there is no free plan - just a one month trial. Then we’d have to subscribe at $69,- per month. looks like we have to switch to GitHub Actions after all.

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 26, 2022, 8:42am UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/7 "2022-04-26T08:42:21Z")

</div>

I can have a look at that, if you want, I have set it up a few times

---

<div class="post-metadata">

### Author: ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)
#### Post date: [April 26, 2022, 9:00am UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/8 "2022-04-26T09:00:40Z")

</div>

That would be very much appreciated.  
It is essential to check the incoming PRs before merging.  
Perhaps I can take a peek in one of your projects to see and compare?

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 26, 2022, 9:09am UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/9 "2022-04-26T09:09:00Z")

</div>

Sure, but some of my work was for blender, to run multiple blender builds like one runs multiple python builds, so it was a little more involved, but the infrastructure can be seen here:

> <https://github.com/nangtani/blender-import-lwo/blob/master/.github/workflows/test_io_scene_lwo.yml>

Edit: The cool upgrade we got over travis, at the time, was that we could also run tests on windows and mac, in addition to linux.

---

<div class="post-metadata">

### Author: ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)
#### Post date: [April 26, 2022, 10:56am UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/10 "2022-04-26T10:56:31Z")

</div>

Dave,

Adding Windows and Mac is cool. (I will catch some flak?)  
I will read up on Github Actions asap. This week is too busy …  
And then try to digest your config file.

Regards,  
Josy

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 26, 2022, 12:43pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/11 "2022-04-26T12:43:28Z")

</div>

I did a quick pass through got something functional:

> <https://github.com/myhdl/myhdl/pull/369>
>
> Initial yml file for github actions.
> 
> It works for \`core \`and \`iverilog\`, but …there are install issues with \`ghdl\`:
> 
> \`\`\`
> Err:30 http://ppa.launchpad.net/mati75/ghdl/ubuntu focal Release
> 404 Not Found \[IP: 91.189.95.85 80\]
> Reading package lists...
> E: The repository 'http://ppa.launchpad.net/mati75/ghdl/ubuntu focal Release' does not have a Release file.
> Error: Process completed with exit code 100.
> \`\`\`
> 
> I am having issues locally too with ghdl, so hopefully who some of these warnings make sense, but the core functionality for the github action is there!

However there is something weird going on with the ghdl install, it complains when I try and add the ppa key and I have loads of failures locally when I try and run it (may or may not be related).

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 26, 2022, 12:44pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/12 "2022-04-26T12:44:48Z")

</div>

Here is a completed run, for reference:

> <https://github.com/daxzio/myhdl/actions/runs/2226716723>

---

<div class="post-metadata">

### Author: ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)
#### Post date: [April 26, 2022, 2:10pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/13 "2022-04-26T14:10:30Z")

</div>

I triggered the Actins on the official repo.  
It fails for GHDL as well.  
 → pck\_myhdl\_011.vhd:8:10: unit “numeric\_std” not found in library “ieee”

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 26, 2022, 2:14pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/14 "2022-04-26T14:14:06Z")

</div>

Well that’s good in that it is consistent. I think this is a real issue that needs to be debugged. That is the ghdl that can be installed from ubuntu doing a apt install.

There is a feature in actions (that is also in travis) where you can run nightly builds (or weekly) this can catch cases where the dependent software you are using is also changing in time and may actually break after your last check in. This is why I set it up for blender that it was in high flux at the time allowed me to catch them when they were breaking the API (which they did between version 2.79 and 2.80).

Can you do a clean install and run locally?

---

<div class="post-metadata">

### Author: ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)
#### Post date: [April 26, 2022, 2:15pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/15 "2022-04-26T14:15:41Z")

</div>

I shook the tree:  
maybe this gives a hint: [vhld 2008 libraries missing in ghdl installation - Stack Overflow](https://stackoverflow.com/questions/61202750/vhld-2008-libraries-missing-in-ghdl-installation)

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 26, 2022, 2:16pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/16 "2022-04-26T14:16:38Z")

</div>

Did there used to be a special version of ghdl that you guys were using? But is no longer available?

```auto
      sudo add-apt-repository ppa:mati75/ghdl -y;

Err:30 http://ppa.launchpad.net/mati75/ghdl/ubuntu focal Release
  404 Not Found [IP: 91.189.95.85 80]
Reading package lists...
E: The repository 'http://ppa.launchpad.net/mati75/ghdl/ubuntu focal Release' does not have a Release file.
Error: Process completed with exit code 100.

```

---

<div class="post-metadata">

### Author: ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)
#### Post date: [April 26, 2022, 2:18pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/17 "2022-04-26T14:18:31Z")

</div>

> Did there used to be a special version of ghdl that you guys were using? But is no longer available?

I remember something of that kind of GHDL being version dependent.  
(this something I hate about open source: they keep on breaking code every other day)

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 26, 2022, 2:20pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/18 "2022-04-26T14:20:47Z")

</div>

From that page:

> It seems that the package of GHDL that you installed was built with “openieee”, instead of including libs from IEEE. This is because of licensing/distribution issues. You need to install a “regular” build of GHDL, or to download and build/install the libraries from [https://github.com/ghdl/ghdl/tree/master/libraries](https://github.com/ghdl/ghdl/tree/master/libraries).

I am not sure how one does that from apt or without building from source, but it is a hint, I imagine this would have been an issue on travis.

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 26, 2022, 2:29pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/19 "2022-04-26T14:29:23Z")

</div>

OK this is what a build from source looks like:

> <https://github.com/daxzio/myhdl/actions/runs/2227368593>

It takes a little longer, 2 minutes instead of 30 seconds, but maybe not a bad way to go to maintain tracking with the head of ghdl. That may not be where you want to be.

---

<div class="post-metadata">

### Author: ![davekeeshan](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/davekeeshan/32/186_2.png) [@davekeeshan](https://discourse.myhdl.org/u/davekeeshan)
#### Post date: [April 26, 2022, 2:37pm UTC](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535/20 "2022-04-26T14:37:27Z")

</div>

All greens! If you think this is a way you want to proceed I can merge this version into the pull request

[Next page](https://discourse.myhdl.org/t/multiple-always-comb-needed-why/535.md?page=2)
