Shyam Joe
Junior Member level 3
- Joined
- Aug 21, 2013
- Messages
- 28
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 322
module fpunit(p,co,clk,a,b);
input [255:0] p;
input co;
input clk;
inout [255:0] a,b;
wire c1,c2,c3,c4;
wire [255:0] t1,t2,u,s1,s2,s3,s4,s5,s6;
wire [256:0] v1,w1,v2,w2;
parallelreg a1(
.din (256'b0),
.clk (clk),
.rst (1'b1),
.dout (s1)
);
parallelreg a2(
.din (256'b0),
.clk (clk),
.rst (1'b1),
.dout (s2)
);
flp a4(
.u (u),
.v (v1)
);
notb a5(
.a (s2),
.y (s3)
);
muxb a6(
.a (s1),
.b (s3),
.s (co),
.y (s4)
);
bitadd a7(
.a (s1),
.b (s4),
.cin (co),
.c (v2)
);
notg a8(
.a (co),
.b (c3)
);
notb a9(
.a (p),
.y (a5)
);
muxb a10(
.a (p),
.b (s5),
.s (c3),
.y (s6)
);
bitadd a12(
.a (v1),
.b (s6),
.cin (1'b1),
.c (w1)
);
bitadd a13(
.a (v2),
.b (s6),
.cin (c3),
.c (w2)
);
org a14(
.a (w1[256]),
.b (v1[256]),
.y (c1)
);
org a15(
.a (w2[256]),
.b (v2[256]),
.y (c4)
);
muxg a16(
.a (v2[256]),
.b (c4),
.s (c3),
.y (c2)
);
muxb a17(
.a (w1[255:0]),
.b (v1[255:0]),
.s (c1),
.y (t1)
);
muxb a18(
.a (w2[255:0]),
.b (v2[255:0]),
.s (c2),
.y (t2)
);
parallelreg a21(
.din (a),
.clk (clk),
.rst (1'b0),
.dout (s1)
);
parallelreg a22(
.din (b),
.clk (clk),
.rst (1'b0),
.dout (s2)
);
generate
genvar i;
for(i=255;i>=0;i=i-1)
begin: ABC
muxb a3(
.a (s1),
.b (s2),
.s (b[i]),
.y (u)
);
muxb a19(
.a (t1),
.b (t2),
.s (b[i]),
.y (a)
);
muxb a20(
.a (t2),
.b (t1),
.s (b[i]),
.y (b)
);
end
endgenerate
endmodule
this is my coding
i got this error..Code:module fpunit(p,co,clk,a,b); input [255:0] p; input co; input clk; inout [255:0] a,b; wire c1,c2,c3,c4; wire [255:0] t1,t2,u,s1,s2,s3,s4,s5,s6; wire [256:0] v1,w1,v2,w2; parallelreg a1( .din (256'b0), .clk (clk), .rst (1'b1), .dout (s1) ); parallelreg a2( .din (256'b0), .clk (clk), .rst (1'b1), .dout (s2) ); flp a4( .u (u), .v (v1) ); notb a5( .a (s2), .y (s3) ); muxb a6( .a (s1), .b (s3), .s (co), .y (s4) ); bitadd a7( .a (s1), .b (s4), .cin (co), .c (v2) ); notg a8( .a (co), .b (c3) ); notb a9( .a (p), .y (a5) ); muxb a10( .a (p), .b (s5), .s (c3), .y (s6) ); bitadd a12( .a (v1), .b (s6), .cin (1'b1), .c (w1) ); bitadd a13( .a (v2), .b (s6), .cin (c3), .c (w2) ); org a14( .a (w1[256]), .b (v1[256]), .y (c1) ); org a15( .a (w2[256]), .b (v2[256]), .y (c4) ); muxg a16( .a (v2[256]), .b (c4), .s (c3), .y (c2) ); muxb a17( .a (w1[255:0]), .b (v1[255:0]), .s (c1), .y (t1) ); muxb a18( .a (w2[255:0]), .b (v2[255:0]), .s (c2), .y (t2) ); parallelreg a21( .din (a), .clk (clk), .rst (1'b0), .dout (s1) ); parallelreg a22( .din (b), .clk (clk), .rst (1'b0), .dout (s2) ); generate genvar i; for(i=255;i>=0;i=i-1) begin: ABC muxb a3( .a (s1), .b (s2), .s (b[i]), .y (u) ); muxb a19( .a (t1), .b (t2), .s (b[i]), .y (a) ); muxb a20( .a (t2), .b (t1), .s (b[i]), .y (b) ); end endgenerate endmodule
=========================================================================
WARNING:HDLCompilers:261 - "fpunit.v" line 23 Connection to output port 'v' does not match port size
ERROR:HDLCompilers:246 - "fpunit.v" line 47 Reference to module 'notb' is not a legal net lvalue
ERROR:HDLCompilers:102 - "fpunit.v" line 47 Connection to output port 'y' must be a net lvalue
WARNING:HDLCompilers:259 - "fpunit.v" line 56 Connection to input port 'a' does not match port size
WARNING:HDLCompilers:259 - "fpunit.v" line 62 Connection to input port 'a' does not match port size
plz help to rectify it
module fpunit(p,co,clk,a,b);
input [255:0] p;
input co;
input clk;
inout [255:0] a,b;
wire c1,c2,c3,c4;
wire [255:0] t1,t2,u,s1,s2,s3,s4,s5,s6;
wire [255:0] v1;
wire [256:0] v2,w1,w2;
parallelreg a1(
.din (256'b0),
.clk (clk),
.rst (1'b1),
.dout (s1)
);
parallelreg a2(
.din (256'b0),
.clk (clk),
.rst (1'b1),
.dout (s2)
);
flp a4(
.u (u),
.v (v1)
);
notb a5(
.a (s2),
.y (s3)
);
muxb a6(
.a (s1),
.b (s3),
.s (co),
.y (s4)
);
bitadd a7(
.a (s1),
.b (s4),
.cin (co),
.c (v2)
);
notg a8(
.a (co),
.b (c3)
);
notb a9(
.a (p),
.y (s5)
);
muxb a10(
.a (p),
.b (s5),
.s (c3),
.y (s6)
);
bitadd a12(
.a (v1),
.b (s6),
.cin (1'b1),
.c (w1)
);
bitadd a13(
.a (v2[255:0]),
.b (s6),
.cin (c3),
.c (w2)
);
org a14(
.a (w1[256]),
.b (v1[255]),
.c (c1)
);
org a15(
.a (w2[256]),
.b (v2[256]),
.c (c4)
);
muxg a16(
.a (v2[255]),
.b (c4),
.s (c3),
.y (c2)
);
muxb a17(
.a (w1[255:0]),
.b (v1[255:0]),
.s (c1),
.y (t1)
);
muxb a18(
.a (w2[255:0]),
.b (v2[255:0]),
.s (c2),
.y (t2)
);
parallelreg a21(
.din (a),
.clk (clk),
.rst (1'b0),
.dout (s1)
);
parallelreg a22(
.din (b),
.clk (clk),
.rst (1'b0),
.dout (s2)
);
generate
genvar i;
for(i=0;i<256;i=i+1)
begin: ABC
muxb a3(
.a (s1),
.b (s2),
.s (b[i]),
.y (u)
);
muxb a19(
.a (t1),
.b (t2),
.s (b[i]),
.y (a)
);
muxb a20(
.a (t2),
.b (t1),
.s (b[i]),
.y (b)
);
end
endgenerate
endmodule
System Verilog allows for local genvar, but in Shyam Joe's case he's using Modelsom 5.5e which won't support any System Verilog constructs. So yes he has to place the genvar before the generate.genvar should be declared before generate.
why don't you look at some verilog examples ?
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 module flp(v,u); input [255:0] u; output reg [255:0] v; integer i; always @ (u) begin v[0]=u[255]; for(i=1;i<=255;i=i+1) begin v[i]<=u[i-1]; end end endmodule
This looks like a single bit rotate to the left. You could have coded it simply as.
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 module flp(v,u); input [255:0] u; output reg [255:0] v; integer i; always @ (u) begin v[0]=u[255]; for(i=1;i<=255;i=i+1) begin v[i]<=u[i-1]; end end endmodule
Code Verilog - [expand] 1 assign v = {u[254:0], u[255]);
I'm guessing that the dotted lines around the functional blocks were your defined module boundaries? I getting the feeling that you're developing an ASIC with antiquated tools (given the Modelsim 5.5e) and the tools aren't capable of synthesizing more than a 1000 or so gates. So doing more than simple shifts, NOT gates, 2 input muxes is too much for it to handle. :-(It is not school project. i was instructed to do as such as given in the block dig attached
Why not, all reports are about basic Verilog syntax problems, nothing related to Modelsim versions.Is there any possible way to simulate my coding in Modelsim 5.5e itself??
genvar i;
generate
for(i=0;i<256;i=i+1)
begin: ABC
muxb a3(
.a (s1),
.b (s2),
.s (b[i]),
.y (u)
);
muxb a19(
.a (t1),
.b (t2),
.s (b[i]),
.y (a)
);
muxb a20(
.a (t2),
.b (t1),
.s (b[i]),
.y (b)
);
end
endgenerate
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 module mulsubadd(clk,c,a0,a1,a2,b0,b1,b2,t1,t2,t3,p,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11); input [255:0] p; input clk; input c,c1,c5,c6,c7,c8,c9,c10,c11; input [1:0] c2,c3,c4; input [255:0] a0,a1,a2,b0,b1,b2; output [255:0] t1,t2,t3; wire [255:0] w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12,w13,w14; parallelreg reg_1( .din (256'b0), .clk (clk), .rst (c7), .dout (w1) ); parallelreg reg_2( .din (256'b0), .clk (clk), .rst (c8), .dout (w2) ); parallelreg a3( .din (256'b0), .clk (clk), .rst (c10), .dout (w3) ); parallelreg a4( .din (256'b0), .clk (clk), .rst (c11), .dout (w4) ); muxb a5( .a (a0), .b (w1), .s (c1), .y (w5) ); muxc a6( .a (a1), .b (b0), .c (w2), .d (256'b0), .s (c2), .y (w6) ); fpunit a7( .clk (clk), .co (c), .p (p), .a (w5), .b (w6), .t (w11) ); muxc a8( .a (b0), .b (a1), .c (w1), .d (w3), .s (c3), .y (w7) ); muxc a9( .a (b1), .b (w2), .c (w4), .d (256'b0), .s (c4), .y (w8) ); fpunit a10( .clk (clk), .co (c), .p (p), .a (w7), .b (w8), .t (w12) ); muxb a11( .a (w3), .b (a2), .s (c5), .y (w9) ); muxb a12( .a (w4), .b (b2), .s (c6), .y (w10) ); fpunit a13( .clk (clk), .co (c), .p (p), .a (w9), .b (w10), .t (w13) ); muxb a14( .a (w11), .b (w13), .s (c9), .y (w14) ); parallelreg a15( .din (w11), .clk (clk), .rst (c7), .dout (w1) ); parallelreg a16( .din (w12), .clk (clk), .rst (c8), .dout (w2) ); parallelreg a17( .din (w14), .clk (clk), .rst (c10), .dout (w3) ); parallelreg a18( .din (w12), .clk (clk), .rst (c11), .dout (w4) ); assign t1=w11; assign t2=w12; assign t3=w13; endmodule
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 module fpunit(p,co,clk,a,b,t); input [255:0] p; input co; input clk; inout [255:0] a,b; output [255:0] t; wire c1,c2,c3,c4,v2c,w1c,w2c; wire [255:0] t1,t2,u,s1,s2,s3,s4,s5,s6; wire [255:0] v1,v2,w1,w2; parallelreg a1( .din (256'b0), .clk (clk), .rst (1'b1), .dout (s1) ); parallelreg a2( .din (256'b0), .clk (clk), .rst (1'b1), .dout (s2) ); flp a4( .u (u), .v (v1) ); notb a5( .a (s2), .y (s3) ); muxb a6( .a (s1), .b (s3), .s (co), .y (s4) ); add a7( .a (s1), .b (s4), .cin (co), .v (v2), .co (v2c) ); notg a8( .a (co), .b (c3) ); notb a9( .a (p), .y (s5) ); muxb a10( .a (p), .b (s5), .s (c3), .y (s6) ); add a12( .a (v1), .b (s6), .cin (1'b1), .v (w1), .co (w1c) ); add a13( .a (v2), .b (s6), .cin (c3), .v (w2), .co (w2c) ); org a14( .a (w1c), .b (v1[255]), .c (c1) ); org a15( .a (w2c), .b (v2c), .c (c4) ); muxg a16( .a (v2c), .b (c4), .s (c3), .y (c2) ); muxb a17( .a (w1), .b (v1), .s (c1), .y (t1) ); muxb a18( .a (w2), .b (v2), .s (c2), .y (t2) ); parallelreg a21( .din (a), .clk (clk), .rst (1'b0), .dout (s1) ); parallelreg a22( .din (b), .clk (clk), .rst (1'b0), .dout (s2) ); genvar i; generate for(i=0;i<256;i=i+1) begin: ABC muxb a3( .a (s1), .b (s2), .s (b[i]), .y (u) ); muxb a19( .a (t1), .b (t2), .s (b[i]), .y (a) ); muxb a20( .a (t2), .b (t1), .s (b[i]), .y (b) ); end endgenerate assign t=a-b; endmodule
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 module muxb(a,b,s,y); input [255:0] a,b; input s; output [255:0] y; reg [255:0] y; always @(a,b,s) case(s) 1'b0: y=a; 1'b1: y=b; endcase endmodule
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 module muxc(a,b,c,d,s,y); input [255:0] a,b,c,d; input [1:0] s; output [255:0] y; reg [255:0] y; always @(a,b,c,d,s) case(s) 2'b00: y=a; 2'b01: y=b; 2'b10: y=c; 2'b11: y=d; default: y=256'b0; endcase endmodule
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 module parallelreg(din,clk,rst,dout); input [255:0] din; input clk,rst; output reg [255:0] dout; wire [255:0] din; wire clk,rst; always @(posedge clk or negedge rst) if(!rst) begin dout<=256'b0; end else begin dout<=din; end endmodule
Hi friends i used modelsim 6.3 & i got output
Nw i started to code the next module. The coding is as follows
i'm not getting the output. hw to solve it. i hav attached my module block dig & the output i got
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 module muxc(a,b,c,d,s,y); input [255:0] a,b,c,d; input [1:0] s; output [255:0] y; reg [255:0] y; always @(a,b,c,d,s) case(s) 2'b00: y=a; 2'b01: y=b; 2'b10: y=c; 2'b11: y=d; default: y=256'b0; endcase endmodule
Quick hints:
That aside, put the genvar statement before the generate.
you can place the genvar after the generate and it will be local to that generate. I think this got introduced in SV. I know Modelsim 10.x, Altera, and Xilinx all support this syntax.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?