P4C
The P4 Compiler
Loading...
Searching...
No Matches
InstructionMemory::Use Struct Reference

#include <instruction_memory.h>

Classes

struct  VLIW_Instruction
 

Public Member Functions

void clear ()
 
void merge (const Use &alloc)
 
bool operator!= (const Use &u) const
 
bool operator== (const Use &u) const
 

Public Attributes

std::map< cstring, VLIW_Instructionall_instrs
 

Friends

std::ostream & operator<< (std::ostream &out, const Use &u)
 

Detailed Description

Instruction Memory requires two things:

  1. The RAM line position/color of a word
  2. The code for running this instruction that is written on the RAM line.

Each match saves with it an action to run. Rather than store a full address per match key, which would be 6 bits apiece, if the total number of possible hit actions are <= 8, then the address just needs to be a unique code between 0 and ceil_log2(hit_actions).

The row and color correspond to the instruction memory row and color, while the mem_code is used by the context JSON to know what to write on the SRAM for running this particular action.