diff --git a/.github/workflows/components.yml b/.github/workflows/components.yml index 3f26be75..7ad481a1 100644 --- a/.github/workflows/components.yml +++ b/.github/workflows/components.yml @@ -28,6 +28,17 @@ jobs: pip install -r requirements.txt # ------------- Tests ---------------- - - name: test and16 + + - name: test barrelShifter + run: | + pytest -k barrelShifter + + - name: test orNway run: | - pytest hw/test_components.py -k and16 + pytest hw/test_components.py -k orNway + + - name: test mux4way + run: | + pytest -k test_mux4way -v + + diff --git a/.gitignore b/.gitignore index 168e776a..2127e277 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ htmlcov *.v .direnv/ *.ini +env +.env \ No newline at end of file diff --git a/GRUPO.yml b/GRUPO.yml index f0433867..a0e6029d 100644 --- a/GRUPO.yml +++ b/GRUPO.yml @@ -1 +1,4 @@ -Nome-Grupo: "Macarrao" +{ + Nome-Grupo: "criado" +} + diff --git a/INTEGRANTES.json b/INTEGRANTES.json new file mode 100644 index 00000000..68c634e6 --- /dev/null +++ b/INTEGRANTES.json @@ -0,0 +1,26 @@ +- user: 1 +name: Eduardo Schneider Monteiro de Barros +git-username: eduardosmb +email: eduardosmb@al.insper.edu + +- user: 2 + name: Erik Leonardo Soares de Oliveira + git-username: eriksoaress + email: eriklso@al.insper.edu.br + +-user: 3 +name: Gustavo Antony de Assis +git-username: GustavoAntony +email: gustavoa9@al.insper.edu + + +- user: 4 +name: Matheus Aguiar de Jesus +git-username: c0d8 +email: matheusaj@al.insper.edu + +- user: 5 +name: Marcelo Vampré Ferreira Marchetto +git-username: marchettomarcelo +email: marcelovfm@al.insper.edu.br + diff --git a/hw/components.py b/hw/components.py index aa9336e9..ff9916cc 100644 --- a/hw/components.py +++ b/hw/components.py @@ -12,11 +12,10 @@ def and16(a, b, q): and bit a bit entre a e b """ - foo = Signal(0) @always_comb def comb(): - q.next = foo + q.next = a and b return comb @@ -32,7 +31,7 @@ def or8way(a, b, c, d, e, f, g, h, q): @always_comb def comb(): - q.next = foo + q.next = a or b or c or d or e or f or g or h return comb @@ -49,7 +48,7 @@ def orNway(a, q): @always_comb def comb(): - q.next = foo + q.next = a[0] or a[1] return comb @@ -72,8 +71,10 @@ def barrelShifter(a, dir, size, q): @always_comb def comb(): - q.next = foo - + if dir == 0: + q.next = a >> size + else: + q.next = a << size return comb @@ -85,8 +86,7 @@ def mux2way(q, a, b, sel): b: 16 bits sel: 2 bits - Mux entre a e b, sel é o seletor - """ + Mux entre a e b, sel é o seletor""" foo = Signal(intbv(0)) @always_comb @@ -112,7 +112,21 @@ def mux4way(q, a, b, c, d, sel): @always_comb def comb(): - q.next = foo + sel2= str(sel) + print(sel2) + if sel2 == "0": + q.next = a + + if sel2 == "1": + q.next = b + + if sel2 == "2": + q.next = c + + if sel2 == "3": + q.next = d + + return comb @@ -150,7 +164,12 @@ def deMux2way(a, q0, q1, sel): @always_comb def comb(): - q0.next = foo + lista_entradas = [q0,q1] + for num in range(0, len(lista_entradas)): + if num == sel: + lista_entradas[num].next = a + else: + lista_entradas[num].next = 0 return comb @@ -167,7 +186,12 @@ def deMux4way(a, q0, q1, q2, q3, sel): @always_comb def comb(): - q0.next = foo + saidas = [q0, q1, q2, q3] + for index in range(0, len(saidas)): + if index == sel: + saidas[index].next = a + else: + saidas[index].next = 0 return comb