Last active
August 29, 2015 13:55
-
-
Save christiaanb/8707744 to your computer and use it in GitHub Desktop.
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
interface addOne_i; | |
task automatic run (input integer a, output integer b); | |
b = a + 1; | |
endtask | |
endinterface | |
interface map_i #( parameter N=32, parameter type ELEMTYPE=logic ) | |
( interface f ); | |
task automatic run ( input ELEMTYPE arg [N-1:0] | |
, output ELEMTYPE res [N-1:0]); | |
for (int mapIter=0; mapIter < N; mapIter+=1) | |
f.run(arg[mapIter],res[mapIter]); | |
endtask | |
endinterface | |
module top (input integer in [7:0], output integer out [7:0]); | |
addOne_i addOne(); | |
map_i #(.N($size(in)),.ELEMTYPE(integer)) map(addOne); | |
always_comb | |
map.run(in,out); | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment