ipunished
Junior Member level 3
- Joined
- Mar 15, 2011
- Messages
- 31
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- United Kingdom
- Activity points
- 1,504
Hi,
so i want to make a simple code to make an LED blink.
here is the code I have
here is the testbench.
the problem is I keep getting unknown (x) on led output.. and the register count just keeps on zero..
any ideas whats wrong?
Thanks
so i want to make a simple code to make an LED blink.
here is the code I have
Code:
module led_glow(
input clock,
output led
);
reg [5:0]count;
always @ (posedge clock)
begin
count <= count+1;
end
wire [3:0]PWM_in;
assign PWM_in = count[5]?count[4:1] : ~count[4:1];
reg [4:0]PWM;
always @ (posedge clock)
begin
PWM <= PWM[3:0] + PWM_in;
end
wire out;
assign led = PWM[4];
//assign led = out;
endmodule
here is the testbench.
Code:
module led_glow_test;
// Inputs
reg clock;
reg [5:0]count = 0;
//reg [3:0]PWM_in;
//reg [4:0]PWM;
// Outputs
wire led;
localparam T = 100;
// Instantiate the Unit Under Test (UUT)
led_glow uut (
.clock(clock),
.led(led)
);
initial begin
clock = 0;
forever
#T clock = ~clock;
end
initial begin
// Initialize Inputs
//count = 6'b0;
//PWM_in = 4'b0;
//PWM = 5'b0;
// Wait 100 ns for global reset to finish
#100;
// Add stimulus here
end
endmodule
the problem is I keep getting unknown (x) on led output.. and the register count just keeps on zero..
any ideas whats wrong?
Thanks