Monday, September 26, 2016

verilog singed & unsigned

If the size does not match the number of bits in the value:

  • If the left-most bit of value is 0 or 1, the value is left-extended with 0
  • If the left-most bit of value is Z, the value is left-extended with Z
  • If the left-most bit of value is X, the value is left-extended with X
  • But…a signed value is not sign-extended!

8’hA   unsigned value extends to 00001010
8’shA  signed value extends to     00001010

There are two types of operators in Verilog and SystemVerilog

  • Self-determined operators do not modify their operand(s)
  • Context-determined operators modify all operands to have the same size, using zero-extension or sign-extension

http://www.uccs.edu/~gtumbush/published_papers/Tumbush%20DVCon%2005.pdf

module add_signed_1995 (
      input [2:0] A,
      input [2:0] B,
      output [3:0] Sum );
 assign Sum = {A[2],A} + {B[2],B};
endmodule // add_signed_1995
Code Example 1: Addition - Verilog 1995

 module add_signed_2001 (
      input signed [2:0] A,
      input signed [2:0] B,
      output signed [3:0] Sum );
 assign Sum = A + B;
endmodule // add_signed_2001
Code Example 2: Addition - Verilog 2001

module add_carry_signed_1995 (
      input [2:0] A,
      input [2:0] B,
      input carry_in,
      output [3:0] Sum );
 assign Sum = {A[2],A} + {B[2],B} + carry_in;
endmodule // add_carry_signed_1995
Code Example 3: Add with Carry - Verilog 1995

module add_carry_signed_2001 (
      input signed [2:0] A,
      input signed [2:0] B,
      input carry_in,
      output signed [3:0] Sum );
 assign Sum = A + B + carry_in;
endmodule // add_carry_signed_2001
Code Example 4: Addition with Carry – Incorrect

module add_carry_signed_final (
      input signed [2:0] A,
      input signed [2:0] B,
      input carry_in,
      output signed [3:0] Sum );
 assign Sum = A + B + $signed({1'b0,carry_in}); ;
endmodule // add_carry_signed_final
Code Example 5: Add with Carry - Correct


http://web.mit.edu/6.111/www/f2012/handouts/L08.pdf



MoviePy

User Guide

MoviePy

MoviePy is a Python module for video editing, which can be used for basic operations (like cuts, concatenations, title insertions), video compositing (a.k.a. non-linear editing), video processing, or to create advanced effects. It can read and write the most common video formats, including GIF.

# Video and Audio mixing python script

from moviepy.editor import *

# VIDEO CLIPS
vclip = VideoFileClip("video.mp4") # or .avi, .webm, .gif ...
# AUDIO CLIPS
aclip = AudioFileClip("audio.wav") # or .ogg, .wav... or a video !
final = concatenate_videoclips([vclip]).set_audio(aclip)
final.write_videofile("movie.mp4")