AshkanYJM
Junior Member level 3
- Joined
- Aug 3, 2014
- Messages
- 25
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 3
- Activity points
- 262
Here is my final Code
It gave a green OK Tick! I thank you both, although you mocked me a little but also made my program work which is deeply appreciated.
But Still I have way to go...If you have any advice about the coming approach I am ready to learn!
Code:
[I]module CircularBuffer(Audio_in, Clk, Reset,control,t);
input signed [11:0] Audio_in;
input Clk,Reset,control,t;
reg [11:0]Buff_Array[4095:0];
integer k;
always @ (posedge Clk)
begin
if (Reset == 1)
for (k = 0; k <= 4095; k = k+1)
Buff_Array[k] <= 0;
else
begin
Buff_Array[0] <= Audio_in;
for (k = 1; k <= 4095; k = k+1)
Buff_Array[k] <= Buff_Array[k-1];
end
end
endmodule
module echo(Buff_Array,Audio_out,Clk,Buff_Array1);
input [11:0]Buff_Array;
input Clk;
output reg[11:0]Audio_out;
inout [11:0]Buff_Array1;
integer k;
assign Buff_Array1=Buff_Array>>1;
always @ (posedge Clk)
begin
assign Audio_out=Buff_Array[0]+ Buff_Array1[k];
end
endmodule
module chorus(Buff_Array,Buff_Array1,Audio_out1,Clk);
input [11:0] Buff_Array,Buff_Array1;
input Clk;
output reg[11:0] Audio_out1;
integer G;
integer k;
assign Buff_Array1=Buff_Array>>1;
always @(posedge Clk)
begin
for (k=1;k<=801;k=k+1)
case (k)
...
endcase
assign Audio_out1=Buff_Array[0]+Buff_Array1[G];
end
endmodule
module Flanger(Buff_Array,Audio_out2,Clk,Buff_Array1);
input [11:0]Buff_Array;
input Clk;
output reg [11:0]Audio_out2;
inout [11:0]Buff_Array1;
integer G;
integer k;
always @(posedge Clk)
begin
for (k=1;k<=400;k=k+1)
case (k)
...
endcase
assign Audio_out2=Buff_Array[0]+Buff_Array1[G];
end
endmodule
module Phaser(Buff_Array,Audio_out3,Clk,Buff_Array1);
input [11:0]Buff_Array;
input Clk;
output reg[11:0]Audio_out3;
inout [11:0]Buff_Array1;
integer G;
integer k;
always @ (posedge Clk)
begin
for (k=1;k<401;k=k+1)
case (k)
...
endcase
assign Audio_out3=Buff_Array[0]-Buff_Array1[G];
end
endmodule
module Mux(out1,a,b,s);
input [11:0]a,b;
input [11:0]s;
output [11:0]out1;
wire [11:0]w2,w3;
wire [11:0]w1;
not(w1,s);
and(w2,a,w1);
and(w3,s,b);
and(out1,w2,w3);
endmodule
module mux4to2(Audio_out,Audio_out1,Audio_out2,Audio_out3,s1,s0,out);
input [11:0]Audio_out,Audio_out1,Audio_out2,Audio_out3;
input [11:0]s1,s0;
output [11:0]out;
wire [11:0]w1,w2;
Mux m1(w1,Audio_out,Audio_out1,s0);
Mux m2(w2,Audio_out2,Audio_out3,s0);
Mux m3(out,w1,w2,s1);
endmodule[/I]
It gave a green OK Tick! I thank you both, although you mocked me a little but also made my program work which is deeply appreciated.
But Still I have way to go...If you have any advice about the coming approach I am ready to learn!