CMOS
Advanced Member level 3
I just tried this simple LED blinking code in Verilog and Handel-C. The result I got was stunning. The verilog version blinks LED at much faster rate than Handel-C version on the same FPGA board. Can anyone explain the reason!
Here are the codes
1. Verilog
2. Handel-C Code
Here are the codes
1. Verilog
Code:
module LEDBlink(led1, led2, clk);
input clk;
output led1;
output led2;
reg [23:0] cnt;
always @(posedge clk) cnt<=cnt+24'h1;
assign led1 = cnt[20] & cnt[22] & cnt[23];
assign led2 = cnt[23];
endmodule
2. Handel-C Code
Code:
set clock = external "10" with {rate = 24, standard = "LVTTL"};
unsigned int 1 led1;
interface bus_out() led_pin1(unsigned int 1 led_pin1 = led1) with {data={"97"}, standard = "LVTTL"};
unsigned int 1 led2;
interface bus_out() led_pin2(unsigned int 1 led_pin2 = led2) with {data={"91"}, standard = "LVTTL"};
void main(void)
{
unsigned int 24 cnt;
while(1)
{
cnt++;
led1 = cnt[20] & cnt[22] & cnt[23];
led2 = cnt[23];
}
}