Table of Contents

The Component

In Arx, the component is the basic building block of hardware, comparable to a module in Verilog or the entity-architecture combination in VHDL.

Example 1: Register

The code below shows one of the simplest components that one could describe in Arx (say, the hello world of Arx). It represents a single register. So, at each rising edge of the clock the component copies the data at its input to its output.

copy.arx
component top 
    T_IO        : generic type = bitvector(8)
    data_in     : in T_IO
    data_out    : out T_IO
 
register
    storage     : T_IO = 0
 
begin
    storage = data_in
    data_out = storage
end

The code contains the following information:

Example 2: A Clearable Accumulator

The example below is a somewhat more sophisticated design. Next to a register, it has some combinational logic. It represents a clearable accumulator which adds a sequence of numbers and outputs the result.

reg-cascade.arx
component top
  wl: generic integer = 12
  T_in : generic type = signed(wl  , 1)
  T_out: generic type = signed(wl-2, 1, sat, round)
  T_sum: generic type = signed(wl+5, 6)
  clear: in bit
  data_in : in  T_in
  data_out: out T_out
variable
  sum: T_sum
register
  r: T_sum = 0
begin
  if clear == 1
     sum = data_in
  else
     sum = r + data_in
  end
  r = sum
  data_out = r
end

Remarks:

General Structure

The pseudo-code below lists all possible constituents of a component.

component <component name>
  <generic declarations>
  <generic type declarations>
  <i/o declarations>
  <constant declarations>
  <type declarations>
  <register declarations>
  <variable declarations>
  <subcomponent instantiations>
begin
  <statements>
end

Known Issues

The top-level component needs to be called top in the current version of Arx.