-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
206 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
testsuite/bsc.verilog/splitports/ArgNamesPragma_PortNameConflict.bs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ArgNamesPragma_PortNameConflict where | ||
|
||
import SplitPorts | ||
import CShow | ||
|
||
struct Foo = | ||
x :: Int 8 | ||
y :: Int 8 | ||
z :: Bool | ||
deriving (Bits) | ||
|
||
instance SplitPorts Foo (Port (Int 8), Port (Int 8), Port Bool) where | ||
splitPorts f = (Port f.x, Port f.y, Port f.z) | ||
unsplitPorts (Port x, Port y, Port z) = Foo { x=x; y=y; z=z; } | ||
portNames _ base = Cons (base +++ "_x") $ Cons (base +++ "_y") $ Cons (base +++ "_z") Nil | ||
|
||
interface SplitTest = | ||
putFoo :: Foo -> Bool -> Action {-# prefix = "fooIn", arg_names = ["f", "f_z"] #-} | ||
|
||
{-# synthesize sysArgNamesPragma_PortNameConflict #-} | ||
sysArgNamesPragma_PortNameConflict :: Module SplitTest | ||
sysArgNamesPragma_PortNameConflict = | ||
module | ||
interface | ||
putFoo x y = $display "putFoo: " (cshow x) (cshow y) |
7 changes: 7 additions & 0 deletions
7
testsuite/bsc.verilog/splitports/ArgNamesPragma_PortNameConflict.bs.bsc-vcomp-out.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
checking package dependencies | ||
compiling ArgNamesPragma_PortNameConflict.bs | ||
code generation for sysArgNamesPragma_PortNameConflict starts | ||
Error: "ArgNamesPragma_PortNameConflict.bs", line 21, column 0: (G0055) | ||
Method `putFoo' generates a port with name `fooIn_f_z' which conflicts with | ||
a port of the same name generated by method `putFoo' at location | ||
"ArgNamesPragma_PortNameConflict.bs", line 21, column 0. |
25 changes: 25 additions & 0 deletions
25
testsuite/bsc.verilog/splitports/BadSplitInst_PortNameConflict.bs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package BadSplitInst_PortNameConflict where | ||
|
||
import SplitPorts | ||
import CShow | ||
|
||
struct Foo = | ||
x :: Int 8 | ||
y :: Int 8 | ||
z :: Bool | ||
deriving (Bits) | ||
|
||
instance SplitPorts Foo (Port (Int 8), Port (Int 8), Port Bool) where | ||
splitPorts f = (Port f.x, Port f.y, Port f.z) | ||
unsplitPorts (Port x, Port y, Port z) = Foo { x=x; y=y; z=z; } | ||
portNames _ base = Cons (base +++ "_x") $ Cons (base +++ "_y") $ Cons (base +++ "_x") Nil | ||
|
||
interface SplitTest = | ||
putFoo :: Foo -> Action {-# prefix = "fooIn" #-} | ||
|
||
{-# synthesize sysBadSplitInst_PortNameConflict #-} | ||
sysBadSplitInst_PortNameConflict :: Module SplitTest | ||
sysBadSplitInst_PortNameConflict = | ||
module | ||
interface | ||
putFoo x = $display "putFoo: " (cshow x) |
7 changes: 7 additions & 0 deletions
7
testsuite/bsc.verilog/splitports/BadSplitInst_PortNameConflict.bs.bsc-vcomp-out.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
checking package dependencies | ||
compiling BadSplitInst_PortNameConflict.bs | ||
code generation for sysBadSplitInst_PortNameConflict starts | ||
Error: "BadSplitInst_PortNameConflict.bs", line 21, column 0: (G0055) | ||
Method `putFoo' generates a port with name `fooIn_1_x' which conflicts with | ||
a port of the same name generated by method `putFoo' at location | ||
"BadSplitInst_PortNameConflict.bs", line 21, column 0. |
24 changes: 24 additions & 0 deletions
24
testsuite/bsc.verilog/splitports/BadSplitInst_TooManyPortNames.bs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package BadSplitInst_TooManyPortNames where | ||
|
||
import SplitPorts | ||
import CShow | ||
|
||
struct Foo = | ||
x :: Int 8 | ||
y :: Int 8 | ||
deriving (Bits) | ||
|
||
instance SplitPorts Foo (Port (Int 8), Port (Int 8)) where | ||
splitPorts f = (Port f.x, Port f.y) | ||
unsplitPorts (Port x, Port y) = Foo { x=x; y=y; } | ||
portNames _ base = Cons (base +++ "_x") $ Cons (base +++ "_y") $ Cons (base +++ "_z") Nil | ||
|
||
interface SplitTest = | ||
putFoo :: Foo -> Action {-# prefix = "fooIn" #-} | ||
|
||
{-# synthesize sysBadSplitInst_TooManyPortNames #-} | ||
sysBadSplitInst_TooManyPortNames :: Module SplitTest | ||
sysBadSplitInst_TooManyPortNames = | ||
module | ||
interface | ||
putFoo x = $display "putFoo: " (cshow x) |
8 changes: 8 additions & 0 deletions
8
testsuite/bsc.verilog/splitports/BadSplitInst_TooManyPortNames.bs.bsc-vcomp-out.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
checking package dependencies | ||
compiling BadSplitInst_TooManyPortNames.bs | ||
code generation for sysBadSplitInst_TooManyPortNames starts | ||
Error: "Prelude.bs", line 4589, column 61: (S0015) | ||
Bluespec evaluation-time error: SplitPorts: fooIn_1 has 2 ports, but 3 port | ||
names were given | ||
During elaboration of `sysBadSplitInst_TooManyPortNames' at | ||
"BadSplitInst_TooManyPortNames.bs", line 20, column 0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package PortNameConflict where | ||
|
||
import SplitPorts | ||
import CShow | ||
|
||
struct Foo = | ||
x :: Int 8 | ||
y :: Int 8 | ||
deriving (Bits) | ||
|
||
instance (ShallowSplitPorts Foo p) => SplitPorts Foo p where | ||
splitPorts = shallowSplitPorts | ||
unsplitPorts = shallowUnsplitPorts | ||
portNames = shallowSplitPortNames | ||
|
||
struct Bar = | ||
f :: Foo | ||
f_x :: Int 16 | ||
deriving (Bits) | ||
|
||
instance (ShallowSplitPorts Bar p) => SplitPorts Bar p where | ||
splitPorts = shallowSplitPorts | ||
unsplitPorts = shallowUnsplitPorts | ||
portNames = shallowSplitPortNames | ||
|
||
interface SplitTest = | ||
putBar :: Bar -> Action {-# prefix = "barIn" #-} | ||
|
||
{-# synthesize sysPortNameConflict #-} | ||
sysPortNameConflict :: Module SplitTest | ||
sysPortNameConflict = | ||
module | ||
interface | ||
putBar x = $display "putBar: " (cshow x) |
7 changes: 7 additions & 0 deletions
7
testsuite/bsc.verilog/splitports/PortNameConflict.bs.bsc-vcomp-out.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
checking package dependencies | ||
compiling PortNameConflict.bs | ||
code generation for sysPortNameConflict starts | ||
Error: "PortNameConflict.bs", line 30, column 0: (G0055) | ||
Method `putBar' generates a port with name `barIn_1_f_x' which conflicts | ||
with a port of the same name generated by method `putBar' at location | ||
"PortNameConflict.bs", line 30, column 0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package SomeArgNames where | ||
|
||
import SplitPorts | ||
import CShow | ||
|
||
struct Foo = | ||
x :: Int 8 | ||
y :: Int 8 | ||
deriving (Bits) | ||
|
||
instance (ShallowSplitPorts Foo p) => SplitPorts Foo p where | ||
splitPorts = shallowSplitPorts | ||
unsplitPorts = shallowUnsplitPorts | ||
portNames = shallowSplitPortNames | ||
|
||
struct Bar = | ||
f :: Foo | ||
b :: Bool | ||
deriving (Bits) | ||
|
||
instance (ShallowSplitPorts Bar p) => SplitPorts Bar p where | ||
splitPorts = shallowSplitPorts | ||
unsplitPorts = shallowUnsplitPorts | ||
portNames = shallowSplitPortNames | ||
|
||
interface SplitTest = | ||
putFooBar :: Foo -> Bar -> Action {-# arg_names = ["fooIn"] #-} | ||
|
||
{-# synthesize mkSomeArgNamesSplitTest #-} | ||
mkSomeArgNamesSplitTest :: Module SplitTest | ||
mkSomeArgNamesSplitTest = | ||
module | ||
interface | ||
putFooBar x y = $display "putFooBar: " (cshow x) " " (cshow y) | ||
|
||
{-# synthesize sysSomeArgNames #-} | ||
sysSomeArgNames :: Module Empty | ||
sysSomeArgNames = | ||
module | ||
s <- mkSomeArgNamesSplitTest | ||
i :: Reg (UInt 8) <- mkReg 0 | ||
rules | ||
when True ==> i := i + 1 | ||
when i == 0 ==> s.putFooBar (Foo { x = 5; y = 6; }) (Bar { f = Foo { x = 7; y = 8; }; b = True; }) | ||
when i == 1 ==> $finish | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
putFooBar: Foo {x= 5; y= 6} Bar {f=Foo {x= 7; y= 8}; b=True} |