Skip to content

Instantly share code, notes, and snippets.

View tejainece's full-sized avatar

Ravi Teja Gudapati tejainece

View GitHub Profile
@tejainece
tejainece / read_output_correct.vhd
Created January 29, 2014 14:12
Read output ports in Verilog and VHDL. This was written for my blog post.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity ReadOutputCorrect is
PORT (
in1 : IN STD_LOGIC;
in2 : IN STD_LOGIC;
in3 : IN STD_LOGIC;
o1 : OUT STD_LOGIC;
o2 : OUT STD_LOGIC
@tejainece
tejainece / ThisRegWontProduceReg.v
Created January 29, 2014 17:59
Not all variables declared as reg gets synthesized to registers in verilog.
module ThisRegWontProduceReg(
output reg o1,
input i1, i2, i3
);
always @(i1, i2, i3) begin
if (i1 == 1'b1) begin
o1 <= i2;
end else begin
o1 <= i3;
@tejainece
tejainece / RegAssignmentWrong.v
Created January 29, 2014 18:22
Where not to assign wire and reg in Verilog. This was written for demonstration purposes in my blog post.
module RegAssignmentWrong(
output reg o,
input in1,
input in2
);
assign o = in1 & in2;
endmodule
@tejainece
tejainece / Makefile
Last active August 29, 2015 13:56
Motion search using CUDA
all: motion_search_cuda motion_search_cpu
motion_search_cuda: motion_search_cuda.cu
nvcc -o $@ $^
motion_search_cpu: motion_search_cpu.c
gcc -o $@ $^ -std=c99
clean:
rm motion_search_cuda motion_search_cpu output_cuda.yuv output_cpu.yuv
@tejainece
tejainece / xbee_send.pde
Created February 16, 2014 18:56
Waspmote v1.1: Broadcast a message using XBee S1 through 802.15.4 protocol.
char* data="Please work! :P";
packetXBee* paq_sent;
uint8_t PANID[2] = {0x33, 0x32};
uint8_t dest_addr[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF};
int i = 0;
void setup() {
xbee802.init(XBEE_802_15_4, FREQ2_4G, NORMAL);
@tejainece
tejainece / embedding_polymorphism.go
Last active August 29, 2015 13:57
Golang: embedding pointer anonymous members
package main
import (
"fmt"
)
type Mammal struct {
Lung string
}
@tejainece
tejainece / Makefile
Last active August 29, 2015 13:57
TinyOS broadcast 802.15.4 compliant messages using non-beacon enabled direct transmission.
COMPONENT=Send_BC_D_N154C
CFLAGS += -I$(shell pwd)/..
# To use the TKN15.4 MAC instead of a platform's default MAC protocol first
# include the TinyOS "Makerules" file as usual ...
include $(MAKERULES)
# ... and then include the TKN15.4 "Makefile.include" file. That's all.
# Hint: type "make <platform> verbose" to see the aggregate include path.
include $(TOSDIR)/lib/mac/tkn154/Makefile.include
@tejainece
tejainece / Makefile
Created March 14, 2014 06:09
TinyOS send point2point 802.15.4 compliant message using non-beacon enabled direct transmission
COMPONENT=Send_p2p_D_N154C
CFLAGS += -I$(shell pwd)/..
# To use the TKN15.4 MAC instead of a platform's default MAC protocol first
# include the TinyOS "Makerules" file as usual ...
include $(MAKERULES)
# ... and then include the TKN15.4 "Makefile.include" file. That's all.
# Hint: type "make <platform> verbose" to see the aggregate include path.
include $(TOSDIR)/lib/mac/tkn154/Makefile.include
@tejainece
tejainece / Makefile
Created March 14, 2014 06:11
TinyOS: Receive 802.15.4 compliant messages that are sent using non-beacon direct transmission.
COMPONENT=Receive_D_N154C
CFLAGS += -I$(shell pwd)/..
# To use the TKN15.4 MAC instead of a platform's default MAC protocol first
# include the TinyOS "Makerules" file as usual ...
include $(MAKERULES)
# ... and then include the TKN15.4 "Makefile.include" file. That's all.
# Hint: type "make <platform> verbose" to see the aggregate include path.
include $(TOSDIR)/lib/mac/tkn154/Makefile.include
@tejainece
tejainece / build_seriallisten15-4.sh
Created March 14, 2014 06:22
TinyOS: Build seriallisten15-4
#!/bin/sh
#build libmote.a
cd ${TOSROOT}/support/sdk/c/sf/
./bootstrap
./configure
make
#build seriallisten15-4.c
cd ${TOSROOT}/apps/BaseStation15.4