naveenkumarmadala
Newbie level 3
- Joined
- Mar 16, 2015
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 47
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 module mnk(clk,rst,in,out); input clk,rst; input [7:0]in; output reg[7:0]out; wire [7:0]w1; wire [7:0]w2; wire [7:0]w3; wire [7:0]w4; wire [7:0]w5; wire [7:0]w6; wire [7:0]w7; always@(posedge clk or rst) begin if(rst) begin out[7:0]<=8'b0; end else begin ca90 dut0(clk,rst,in,w1); ca90 dut1(clk,rst,w1,w2); ca90 dut2(clk,rst,w2,w3); ca90 dut3(clk,rst,w3,w4); ca90 dut4(clk,rst,w4,w5); ca90 dut5(clk,rst,w5,w6); ca90 dut6(clk,rst,w6,w7); ca90 dut7(clk,rst,w7,out); end end endmodule module ca90(clk,rst,s,q); input clk,rst; input [7:0]s; output reg[7:0]q; always@(posedge clk or rst) begin if(rst) begin q[7:0] =8'b0; end else begin q[0]=0^s[1]; q[1]=s[0]^s[2]; q[2]=s[1]^s[3]; q[3]=s[2]^s[4]; q[4]=s[3]^s[5]; q[5]=s[4]^s[6]; q[6]=s[5]^s[7]; q[7]=s[6]^0; end end 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 module mnk_kr( input clk,rst, input [7:0]in, output reg[7:0]out); wire [7:0]w1; wire [7:0]w2; wire [7:0]w3; wire [7:0]w4; wire [7:0]w5; wire [7:0]w6; wire [7:0]w7; ca90 dut0(clk,rst,in,w1); ca90 dut1(clk,rst,w1,w2); ca90 dut2(clk,rst,w2,w3); ca90 dut3(clk,rst,w3,w4); ca90 dut4(clk,rst,w4,w5); ca90 dut5(clk,rst,w5,w6); ca90 dut6(clk,rst,w6,w7); ca90 dut7(clk,rst,w7,out); endmodule module ca90( input clk,rst, input [7:0]s, output reg[7:0]q); always@(posedge clk , posedge rst) begin if(rst) begin q[7:0] =8'b0; end else begin q[0]=0^s[1]; q[1]=s[0]^s[2]; q[2]=s[1]^s[3]; q[3]=s[2]^s[4]; q[4]=s[3]^s[5]; q[5]=s[4]^s[6]; q[6]=s[5]^s[7]; q[7]=s[6]^0; end end endmodule
Code Verilog - [expand] 1 2 3 4 5 6 initial begin clk = 0; forever begin #50 clk = !clk; end end
- placing the clk generation in initial block
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 module mnk_kr_tb; reg clk; reg rst; reg [7:0] in; wire [7:0] out; mnk_kr uut ( .clk(clk), .rst(rst), .in(in), .out(out) ); initial begin rst = 1; in = 8'b10100110; #100; rst = 0; in = 8'b10100110; end initial begin clk <= 0; forever begin #5 clk <= ~clk; end end endmodule
>xvlog mnk_kr_tb.v
INFO: [VRFC 10-2263] Analyzing Verilog file "mnk_kr_tb.v" into library work
INFO: [VRFC 10-311] analyzing module mnk_kr
INFO: [VRFC 10-311] analyzing module ca90
INFO: [VRFC 10-311] analyzing module mnk_kr_tb
>xelab -debug all mnk_kr_tb
Vivado Simulator 2014.3
Copyright 1986-1999, 2001-2014 Xilinx, Inc. All Rights Reserved.
Running: C:/Xilinx/Vivado/2014.3/bin/unwrapped/win64.o/xelab.exe -debug all mnk_kr_tb
Multi-threading is on. Using 2 slave threads.
Starting static elaboration
ERROR: [VRFC 10-529] concurrent assignment to a non-net out is not permitted [mnk_kr_tb.v:21]
ERROR: [XSIM 43-3322] Static elaboration of top level Verilog design unit(s) in library work failed.
Code Verilog - [expand] 1 2 3 4 5 6 module mnk_kr( input clk,rst, input [7:0]in, output reg[7:0]out); ca90 dut7(clk,rst,w7,out);
Code Verilog - [expand] 1 2 3 4 module mnk_kr( input clk,rst, input [7:0]in, output [7:0]out);
>xvlog mnk_kr_tb.v
INFO: [VRFC 10-2263] Analyzing Verilog file "mnk_kr_tb.v" into library work
INFO: [VRFC 10-311] analyzing module mnk_kr
INFO: [VRFC 10-311] analyzing module ca90
INFO: [VRFC 10-311] analyzing module mnk_kr_tb
>xelab -debug all mnk_kr_tb
Vivado Simulator 2014.3
Copyright 1986-1999, 2001-2014 Xilinx, Inc. All Rights Reserved.
Running: C:/Xilinx/Vivado/2014.3/bin/unwrapped/win64.o/xelab.exe -debug all mnk_kr_tb
Multi-threading is on. Using 2 slave threads.
Starting static elaboration
Completed static elaboration
Starting simulation data flow analysis
Completed simulation data flow analysis
Time Resolution for simulation is 1ps
Compiling module work.ca90
Compiling module work.mnk_kr
Compiling module work.mnk_kr_tb
Waiting for 2 sub-compilation(s) to finish...
0 sub-compilation(s) remaining...
Built simulation snapshot work.mnk_kr_tb
****** Webtalk v2014.3.1 (64-bit)
**** SW Build 1034051 on Fri Oct 3 17:14:12 MDT 2014
**** IP Build 1028902 on Fri Sep 26 17:35:13 MDT 2014
** Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
source xsim.dir/work.mnk_kr_tb/webtalk/xsim_webtalk.tcl -notrace
INFO: [Common 17-186] 'xsim.dir/work.mnk_kr_tb/webtalk/usage_statistics_ext_xsim.xml' has been successfully sent to Xi
linx on Tue Mar 17 12:30:39 2015. For additional details about this file, please refer to the WebTalk help file at C:/Xilinx/Vivado/2014.3/doc/webtalk_introduct
ion.html.
INFO: [Common 17-206] Exiting Webtalk at Tue Mar 17 12:30:39 2015...
>xsim -gui mnk_kr_tb
****** xsim v2014.3.1 (64-bit)
**** SW Build 1034051 on Fri Oct 3 17:14:12 MDT 2014
**** IP Build 1028902 on Fri Sep 26 17:35:13 MDT 2014
** Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
start_gui
Altera Quartus and Modelsim have apparently no problems with output ports connected to a reg data type. Neither a warning nor problems in simulating the design. This may be a concession to SystemVerilog that allows variable types (e.g. reg) connected to output ports.which results in a problem in elaboration, since you can't connect an output of a instance to an output port using reg. You need to use wire...
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?