Chapter 2 : Data types. Extension Data Type Overview NameDescription sc_bitsingle bit with two values, ‘0’ and ‘1’ sc_bv Arbitrary width bit vector sc_logicSignle.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Linear Lists – Array Representation
Today’s lecture Review of Chapter 1 Go over homework exercises for chapter 1.
Lecture # 21 Chapter 6 Uptill 6.4. Type System A type system is a collection of rules for assigning type expressions to the various parts of the program.
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
CS 3850 Lecture 4 Data Type. Physical Data Types The primary data types are for modeling registers (reg) and wires (wire). The reg variables store the.
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 15: SystemC (3/3) Prof. Sherief Reda Division of.
More on Numerical Computation CS-2301 B-term More on Numerical Computation CS-2301, System Programming for Non-majors (Slides include materials from.
More about Numerical Computation CS-2301, B-Term More about Numerical Computation CS-2301, System Programming for Non-Majors (Slides include materials.
2015/8/221 Data Types & Operators Lecture from (Chapter 3,4)
1 Operator Overloading in C++ Copyright Kip Irvine, All rights reserved. Only students enrolled in COP 4338 at Florida International University may.
Operators & Overloading Joe Meehean. Expressions Expression composed of operands combined with operators e.g., a + b Operands variables and literals in.
Variable, Expressions, Statements and Operators By: Engr. Faisal ur Rehman CE-105 Fall 2007.
SystemC Tutorial Author: Silvio Veloso
UniMAP Sem2-08/09 DKT121: Fundamental of Computer Programming1 Introduction to C – Part 2.
Java Tutorial. Object-Oriented Programming Concepts Object –a representation of some item state  fields/members and should be encapsulated behavior 
Chapter 8 Friends and Overloaded Operators. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. Slide 2 Overview Friend Function (8.1) Overloading.
Simple Data Types and Statements. Namespaces namespace MyNamespace { // …. { MyNamespace::func1() using namespace OtherNamespace; Comments: // /* xxxx.
Operatorsand Operators Overloading. Introduction C++ allows operators to be overloaded specifically for a user-defined class. Operator overloading offers.
UniMAP Sem1-07/08EKT120: Computer Programming1 Week2.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
Design & Co-design of Embedded Systems Combinational Logic in SystemC Maziar Goudarzi.
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
Winter-Spring 2001Codesign of Embedded Systems1 Reactivity, Ports, and Signals in SystemC Part of HW/SW Codesign of Embedded Systems Course (CE )
1 Very Large Scale Integration II - VLSI II SystemC Gürer Özbek ITU VLSI Laboratories Istanbul Technical University.
Java operatoriai sandbolts/operators.html
3: Controlling Program Flow Using Java operators Mathematical operators Relational operators Logical operators –Primitive type: ALL (the same with C) –String:
Design & Co-design of Embedded Systems Data Types in SystemC Maziar Goudarzi.
Programming Fundamentals. Today’s Lecture The Conditional Operator Logical Operators Structures Enumerations.
Vladimir Misic: Characters and Strings1Tuesday, 9:39 AM Characters and Strings.
Java Language Basics By Keywords Keywords of Java are given below – abstract continue for new switch assert *** default goto * package.
Sahar Mosleh California State University San MarcosPage 1 Data Types and Operators.
1 More Operator Overloading Chapter Objectives You will be able to: Define and use an overloaded operator to output objects of your own classes.
CPE 626 The SystemC Language Aleksandar Milenkovic Web:
Expressions and Operators in C. Expressions and Operators Examples: 3 + 5; x; x=0; x=x+1; printf("%d",x); Two types: – Function calls – The expressions.
Lecture 2 Functions. Functions in C++ long factorial(int n) The return type is long. That means the function will return a long integer to the calling.
CSE 332: C++ template examples Today: Using Class and Function Templates Two examples –Function template for printing different types –Class template for.
Expression and Operator. Expressions and Operators u Examples: 3 + 5; x; x=0; x=x+1; printf("%d",x); u Two types: –Function calls –The expressions formed.
Introduction to CMex E177 April 25, Copyright 2005, Andy Packard. This work is licensed under the Creative.
Quick Summary C++/CLI Basics Data Types Controls Arrays In-class assignments.
UNIMAP Sem2-07/08EKT120: Computer Programming1 Week 2 – Introduction to Programming.
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
CS113 Introduction to C Instructor: Ioannis A. Vetsikas Lecture 2 : August 28 webpage:
CMSC 202 Lesson 26 Miscellaneous Topics. Warmup Decide which of the following are legal statements: int a = 7; const int b = 6; int * const p1 = & a;
Integer VariablestMyn1 Integer Variables It must be possible to store data items in a program, and this facility is provided by variables. A variable is.
C++ Lesson 1.
Data types Data types Basic types
Fundamental of Programming (C)
CISC/CMPE320 - Prof. McLeod
Java operatoriai
SystemC for SoC Designs
Chapter 2.
Lecture 5 from (Chapter 4, pages 73 to 96)
Flow of Control.
Overloading the << operator
More about Numerical Computation
Bits and Bytes Boolean algebra Expressing in C
Flow of Control.
Friends, Overloaded Operators, and Arrays in Classes
Default Parameters February 24, 2016
CISC/CMPE320 - Prof. McLeod
Lesson Subject Book Week 4 lesson 1 Class, copy-constructor
CS150 Introduction to Computer Science 1
2. Second Step for Learning C++ Programming • Data Type • Char • Float
CS150 Introduction to Computer Science 1
CS150 Introduction to Computer Science 1
Names of variables, functions, classes
Module 2 Variables, Data Types and Arithmetic
Lecture 2: Bits, Bytes, Ints
Overloading the << operator
Presentation transcript:

Chapter 2 : Data types

Extension Data Type Overview NameDescription sc_bitsingle bit with two values, ‘0’ and ‘1’ sc_bv Arbitrary width bit vector sc_logicSignle bit with four value, ‘0’, ‘1’, ‘X’ and ‘Z’ sc_lv Arbitrary width logic vector sc_int Signed integer type, up to 64 bits sc_uint Unsigned integer type, up to 64 bits sc_bigint Arbitrary width signed integer type sc_bituint Arbitrary width signed integer type

sc_bit OperatorFunctionUsage &Bitwise ANDexpr1 & expr2 |Bitwise ORexpr1 | expr2 ^Bitwise XORexpr1 ^ expr2 ~Bitwise NOT~ expr1 =Assignmentvalue_holder = expr &=Compound ANDvalue_holder &=expr |=Compound ORvalue_holder |=expr ^=Compound XORvalue_holder ^=expr ==Equalityexpr1 == expr2 |=Inequalityexpr1 != expr2

sc_bv OperatorFunctionUsage []Bit selectionvar[index] (,)Concatenation(expr1, expr2, expr3) MethodFunctionUsage range(0Range selectionvar.range(idx1, idx2) and_reduce()Reduction ANDvar.and_reduce() or_reduceReduction ORvar.or_reduce() xor_reduceReduction XORvar.xor_reduce()

sc_logic and sc_lv Four value  ‘0’, SC_LOGIC_0  ‘1’, SC_LOGIC_1  ‘X’, SC_LOGIC_X  ‘Z’, SC_LOGIC_Z Operation  The same as sc_bit

Integer Type Data width <= 64 bits  sc_int  sc_uint Data width > 64 bits  sc_bitint  sc_biguint Operation  The same as C++ native definition  [ ], (,), range()

User Defined Data Four operator are required  Operator = (assignment)  Operator == (equality)  Operator << (stream output)  sc_trace() Example struct blah { int a, int b; blah& operator= (const blah& arg) { a = arg.a, b= arg.b;}; bool operatro= (const blah& arg) {return a == arg.a && b = arg.b ? true : false;}; ostream& operator<< (ostream& os, const blah& arg) { os << “a : “ << arg.a << “b :” << b; void sc_trace (sc_trace_file *tf, const blah& arg, const sc_string& name) { sc_trace(tf, arg.a, name+”.a”; sc_trace(tf, arg.b, name+”.b”;}; };

Example sc_logic x; // object declaration x = ’1’; // assign a 1 value x = ’Z’; // assign a Z value sc_bv val; val = " "; sc_uint myrange; sc_uint myint; myrange = myint.range(7,4); sc_uint inta; sc_uint intb; sc_uint intc; intc = (inta, intb);

Recommended Data Types Primitive type is better  For one bit, use bool  Replace sc_int and sc_uint by int and unsigned int if acceptable Use sc_logic and sc_lv types when four types are really needed